Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

referencing field on the same form

Locked
brumsumsel
Posts: 2
Joined: Mon Jan 02, 2017 3:42 pm

referencing field on the same form

Unread post by brumsumsel »

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: Mon Jan 02, 2017 3:42 pm

Re: referencing field on the same form

Unread post by brumsumsel »

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()
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: referencing field on the same form

Unread post by admin »

well done!
Locked