default id value when adding new record in browse table

default id value when adding new record in browse table

Postby ScottG » Wed Jan 18, 2017 12:02 am

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
ScottG
 
Posts: 6
Joined: Fri Nov 20, 2015 11:27 am

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

Postby ScottG » Wed Jan 18, 2017 11:50 pm

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
ScottG
 
Posts: 6
Joined: Fri Nov 20, 2015 11:27 am

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

Postby ScottG » Thu Jan 19, 2017 3:40 am

This thread can be closed now, got it working using #nu_browse_filter#
ScottG
 
Posts: 6
Joined: Fri Nov 20, 2015 11:27 am

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

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

ScottG,

Thanks for letting me know.

Steven
admin
Site Admin
 
Posts: 3350
Joined: Mon Jun 15, 2009 9:53 am


Return to General