This topic is locked
[SOLVED]

 Button Value

5/8/2013 3:23:33 AM
PHPRunner General questions
G
GunnySJB author

It must be something simple but just can't get it <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=20962&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />
I have a Add form where i have a button.

This button will lookup something with the field value of the field before the record is saved.
How can i access the field value from the field in the Add form in my OnServer code for my button
Hope i explained it well
So i want to have the field value from a Add form in my button code, in the OnServer tab, before i save the record.

C
cgphp 5/8/2013

Get the field value in the "Client before" tab of the button and send it to the "Server" with the params array:
[Client Before]

params['field_name'] = $("#id_of_the_field").val(); //replace id_of_the_field with the real id of the field


[Server]

$rs = CustomQuery("SELECT * FROM table_name WHERE id =".$params['field_name']); //only an example. You can access the field value using $params['field_name']
G
GunnySJB author 5/8/2013

Hello Christian,
Thank you for your help.

It didn't work inmediatly but with your code to start with i knew where to look :
this is how i made it work :
I had to change the client before to :
var ctrl = Runner.getControl(pageid, 'ISBN');

params['ISBNNR'] = ctrl.getValue();
So thank you very much it was a big help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=70751&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />