Friday, October 17, 2014

Dialog Validation example

Dialog Validation example

In this example we fill the one dialog Field remain Fields going to non edit mode

STEP1:- Create new class and create classDeclaration

class CustSelect extends RunBase
{
    DialogField fieldAccount,fieldName,
                fieldGroup,fieldCurrecncy,
                fieldPaymTermId,fieldPaymMOde;
}

STEP2:- Create Pack Metod


public container pack()

{
    return  conNull();

}


STEP:-3  Create Unpack Method

public boolean unpack (container _packedClass)

{
    return true;
}

STEP:-4 Create Dialog method

protected Object dialog()
{

    Dialog dialog;
    DialogGroup groupCustomer;
    DialogGroup groupPayment;
    dialog = super();
    dialog.caption("Customer information");
    //
    dialog.allowUpdateOnSelectCtrl(true);
    //
    fieldAccount = dialog.addField(extendedTypeStr(CustAccount),"Customer account");
    fieldName = dialog.addField(extendedTypeStr(CustName));

   
    fieldName.enabled(false);

    dialog.addTabPage("Details");

    groupCustomer = dialog.addgroup("Setup");

    fieldGroup = dialog.addField(extendedTypeStr(CustGroupId));
    fieldCurrecncy = dialog.addField(extendedTypeStr(CurrencyCode));
    
    fieldGroup.enabled(false);
    fieldCurrecncy.enabled(false);

    groupPayment = dialog.addGroup("Payment");
    fieldPaymTermId = dialog.addField(extendedTypeStr(CustPaymTermId));
    fieldPaymMOde = dialog.addField(extendedTypeStr(CustPaymMode));
    
    fieldPaymTermId.enabled(false);
    fieldPaymMOde.enabled(false);

    return dialog;

}

STEP:-5 Create DialogSelectCtrl method

public void dialogSelectCtrl()
{
    CustTable custTable;

    custTable =custTable::find(fieldAccount.value());
    fieldName.value(custTable.name());
    fieldGroup.value(custTable.CustGroup);
    fieldCurrecncy.value(custTable.Currency);
    fieldPaymTermId.value(custTable.PaymTermId);
    fieldPaymTermId.value(custTable.PaymMode);

}


STEP6:- Create main method()



public static void main (Args _args)
{
    CustSelect custSelect = new CustSelect();
    if (custSelect.prompt())
    {
        custSelect.run();
    }
}

















No comments:

Post a Comment