Welcome to the nuBuilder forums!

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

Multiple Buttons, one Edit Form

Post Reply
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Multiple Buttons, one Edit Form

Unread post by toms »

Hi,
There are about 10 Button Objects on my Launch Form. Each of them should open the same Edit Form (creating a new record) and set a default value in a specific field.
I could create different Edit Forms for each Button but that would lead to too much redundancy (especially while having custom code attached)

I thought I could run a PHP code on button click to create a new record and set a value by sql for that one specific field and then run another code to take me to the newly created record (opening the Edit Form)

Is this something that can be done (and how?) or is there a better approach to do this?

Thomas
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Multiple Buttons, one Edit Form

Unread post by toms »

Ok, it works by attaching an onclick event

Code: Select all

nuOpenForm('5a06bc2d16edd84', '-1', '5a06bc2d16edd84', '-1', 'My Form'); // -1 --> new record
$('#FieldName').val("Test"); // set a value
nuDisable("FieldName");  // disable the field
Post Reply