Page 1 of 1

default id value when adding new record in browse table

Posted: Tue Jan 17, 2017 3:32 pm
by ScottG
I have a table of say clients with client_id, clients_name, clients_add etc fields I have another table with visits with vis_id, vis_clientid, vis_date, vis_reason etc fields.

In my clients form when I select a client, I have a tab for client details then another tab for visits. In the visits tab I have a browse field with #RECORD_ID# filter to show only the visits to the selected client. You can then select any visit from the browse table and it opens a new window with the visit details, this all works fine,

When I select the "Add Record" button from the browse screen to add a new visit for that client, it opens the blank visit form in the same window as the browse field, but what I am looking to do is to default the vis_clientid field in the visit form to be the value of the selected Client_id. Thought that I could use #RECORD_ID# but of course this is blanked for a new record. Any suggestion on how I can do this

Re: default id value when adding new record in browse table

Posted: Wed Jan 18, 2017 3:20 pm
by ScottG
To hopefully explain it a bit better, using screenshots, its similar to the browse example in the wiki at http://wiki.nubuilder.net/nubuilderv3/i ... Browse_Tab but with the Outstanding Invoices tab having the default New Record button to add a new invoice for that customer and the New record form automatically coming up with the customers name already filled in.

I have tried using nuSetHash('ctempid', cid); within nuLoadBrowse() and
var cfid = nuGetHash('ctempid'); within nuLoadEdit()
but this doesnt work

So Any ideas of how to pass a field value from the browse screen to the Add New edit screen so that I can auto fill a field would be helpful

Re: default id value when adding new record in browse table

Posted: Wed Jan 18, 2017 7:10 pm
by ScottG
This thread can be closed now, got it working using #nu_browse_filter#

Re: default id value when adding new record in browse table

Posted: Tue Jan 24, 2017 2:58 am
by admin
ScottG,

Thanks for letting me know.

Steven