referencing field on the same form

referencing field on the same form

Postby brumsumsel » Tue Jan 03, 2017 3:46 pm

Hi,
i think it's a trivial question but i didn't find a solution (maybe of my worst english).
I try to create a small accounting app. In the form is one dropdown field with the accounting type (income, expense) and another dropdown field with the account. The database table for the accounts contain both, income and expense accounts. In the field for the accounts i only want to display the accounts which match the formfield acc_type. How can i reference the accounting type field in my SQL for the account field?
select account_id, account_desc from tbl_account where account_type = ????
Is there a easy solution for this?

Thanks
Thomas
brumsumsel
 
Posts: 2
Joined: Tue Jan 03, 2017 12:12 am

Re: referencing field on the same form

Postby brumsumsel » Wed Jan 04, 2017 10:16 pm

OK, i found a solution. As expected it wasn't difficult.
select account_id, account_desc from tbl_account where account_type = '#acc_type#'
is correct. But it is nessaccary to save the form after editing the acc_type field. By adding a event on this field the form is saved and the query in the account field deliver the correct result.
Eventname: onchange
Javascript: nuSaveForm()
brumsumsel
 
Posts: 2
Joined: Tue Jan 03, 2017 12:12 am

Re: referencing field on the same form

Postby admin » Tue Jan 24, 2017 11:59 am

well done!
admin
Site Admin
 
Posts: 3348
Joined: Mon Jun 15, 2009 9:53 am


Return to General