Page 1 of 1

Multiple Buttons, one Edit Form

PostPosted: Tue Nov 14, 2017 4:40 pm
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

Re: Multiple Buttons, one Edit Form

PostPosted: Tue Nov 14, 2017 5:27 pm
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