This topic is locked

Adding html event code snippet to Button to fire onclick

5/23/2009 8:07:03 PM
PHPRunner General questions
B
bochaka author

I added new button to my project which onclicked I had hoped would execute a custom code snippet on the button event page. I added my button HTML code which mysteriously gets changed around after build, and my button does not trigger the event on the buttons custom snippet. I get no errors so ichanged the custom event php code to a simple echo command, which does nothing either. I am attaching my now totally jumbled HTML code in the hope that someone can give me a pointer on how it should be.The button no longer shows up at this point, but still no errors indicated
<INPUT class=button value=ADD type=button onclick="add_Department_Snippet1();" ><SPAN id=span>&nbsp;</SPAN>
Basically I need my new button to execute the code snippet Snippet1 which is now on the events page
Thanks in advance

Admin 5/25/2009

You cannot execute code snippet (PHP code on server side) from Javascript (runs in browser on the client side).
You need to use approach described at http://www.xlinesoft.com/phprunner/docs/in...ted_records.htm

B
bochaka author 5/25/2009

Hi Sergey
Thank you for the reply. but the example is sending and email. The code I need to run needs to get the selected record. opens the database adds a new record based on the ID, and another field also on the list displays the added record so the user can add more information about newly added record.
how would we add this code to the on click button event
Thanks in advance

Admin 5/25/2009

Once again - you cannot attach PHP code to onclick event.
You need to use the approach described in the manual. Just remove all email related code and put your code there.