I have added one check box in my form and if i tick that check box there are two fields on another form that must be disable and if i enable how can i get this done .
should i have to use chain of comand or i go with event handler of that checkbox. plz guide me on this.
No need to change anything. Code you have written is correct.
Thanks,
Girish S.
yes it is working , element.args().record() is getting the record . current code is below do i need to change anything .
[ExtensionOf(formDataSourceStr(TransTaxInformation,TransTaxInformation))]
final class dtGeneralLedgerChKBx_Extension
{
public int active()
{
int ret;
TransTaxInformation transTaxInformation;
LedgerJournalTrans ledgerJournalTrans;
ret = next active();
ledgerJournalTrans = element.args().record();
if(ledgerJournalTrans.ChkBox==NoYes::Yes)
{
FormDataSource fds = element.datasource(formDatasourcestr(TransTaxInformation, transTaxInformation));
fds.object(fieldNum(TransTaxInformation, HSNCodeTable)).allowEdit(false);
fds.object(fieldNum(TransTaxInformation, ServiceAccountingCodeTable)).allowEdit(false);
}
else
{
FormDataSource fds = element.datasource(formDatasourcestr(TransTaxInformation, transTaxInformation));
fds.object(fieldNum(TransTaxInformation, HSNCodeTable)).allowEdit(true);
fds.object(fieldNum(TransTaxInformation, ServiceAccountingCodeTable)).allowEdit(true);
}
return ret;
}
}
thanks
What is your issue? Is the element.args().record() returns anything?
Is the functionality working.
As I said earlier cursor method will return current record which is TransTaxInformation.
Thanks,
Girish S.
hi ,
mohit,
so then where should i write this,cursor.
Problem is line#9, this.cursor will return TransTaxInformation and not LedgerJournalTrans table.
i have made changes in code and added this.cursor() but the form is giving error.
[ExtensionOf(formDataSourceStr(TransTaxInformation,TransTaxInformation))] final class dtGeneralLedgerChKBx_Extension { public int active() { int ret; TransTaxInformation transTaxInformation; LedgerJournalTrans ledgerJournalTrans = this.cursor(); ret = next active(); ledgerJournalTrans = element.args().record(); if(ledgerJournalTrans.ChkBox==NoYes::Yes) { FormDataSource fds = element.datasource(formDatasourcestr(TransTaxInformation, transTaxInformation)); fds.object(fieldNum(TransTaxInformation, HSNCodeTable)).allowEdit(false); fds.object(fieldNum(TransTaxInformation, ServiceAccountingCodeTable)).allowEdit(false); } else { FormDataSource fds = element.datasource(formDatasourcestr(TransTaxInformation, transTaxInformation)); fds.object(fieldNum(TransTaxInformation, HSNCodeTable)).allowEdit(true); fds.object(fieldNum(TransTaxInformation, ServiceAccountingCodeTable)).allowEdit(true); } return ret; } }
this.Cursor will return the current record in the DataSource - In your scenario you won't get LedgerJournalTrans as a current record, since the form TransTaxInfomation doesn't have LedgerJournalTrans as a DataSource.
Thanks,
Girish S.
hi mohit ,
thanks for reply,
Replace Line# 8, with below code
LedgerJournalTrans ledgerJournalTrans = this.cursor();
does this get current record, my current code is below.
[ExtensionOf(formDataSourceStr(TransTaxInformation,TransTaxInformation))] final class dtGeneralLedgerChKBx_Extension { public int active() { int ret; TransTaxInformation transTaxInformation; LedgerJournalTrans ledgerJournalTrans; ret = next active(); ledgerJournalTrans = element.args().record(); if(ledgerJournalTrans.ChkBox==NoYes::Yes) { FormDataSource fds = element.datasource(formDatasourcestr(TransTaxInformation, transTaxInformation)); fds.object(fieldNum(TransTaxInformation, HSNCodeTable)).allowEdit(false); fds.object(fieldNum(TransTaxInformation, ServiceAccountingCodeTable)).allowEdit(false); } else { FormDataSource fds = element.datasource(formDatasourcestr(TransTaxInformation, transTaxInformation)); fds.object(fieldNum(TransTaxInformation, HSNCodeTable)).allowEdit(true); fds.object(fieldNum(TransTaxInformation, ServiceAccountingCodeTable)).allowEdit(true); } return ret; } }
I think you need to use the element keyword to get the current record and assign to buffer and later assign the value to buffer.
[ExtensionOf(formDataSourceStr(LedgerJournalTransDaily, LedgerJournalTrans))] final class LedgerJournalTransChkBX_Extension { void initValue() { next initValue(); LedgerJournalTrans ledgerJournalTrans; ledgerJOurnalTrans = element.LedgerJournalTrans; ledgerJournalTrans.ChkBox = NoYes::No; } }
Thanks,
Girish S.
Replace Line# 8, with below code
LedgerJournalTrans ledgerJournalTrans = this.cursor();
André Arnaud de Cal...
291,996
Super User 2025 Season 1
Martin Dráb
230,853
Most Valuable Professional
nmaenpaa
101,156