This topic is locked
[SOLVED]

 PHPRunner v5.3 and custom buttons

5/27/2011 7:03:25 AM
PHPRunner General questions
B
BenjaminJ author

Hello,
This is a simple question, but I didn't found any answer in the forum or in the manual.
I need to update a project created with the version 5.1 of PHPRunner and I would like to "convert" it to v5.3.

I've got some problems, the main one being the different usage of custom buttons.
In an Add page, I used 2 custom buttons :

Button #1 : "Validate" button to validate in the DB a given reference number and get the corresponding description back in a field of the page.

Button #2 : "Save and add details" to save the added data and redirect the page to another add-page (not the list page).
When my project is opened with the v5.3, nothing works and I'm not able to recreate this behaviour anymore (even after a "Reset Page").

Here are the details and the problems :
Button #1

In the Visual Editor tab of the Add page, in HTML mode, I added the following code after the reference text box:

<SPAN class=buttonborder><INPUT id=submit2 class=button value=Validate type=submit name=submit2></SPAN>


In the BeforeAddevent, I first check the reference info with the "values" provided by this event and then:

[..]



$values["JOB_description"] = $data["PRD_description"];

if ($_REQUEST["submit2"]=="Validate")

{

$message = "Reference validated";

return false;

} else {

return true;

}



[..]
In the v5.1, it allowed to show the real description in the corresponding field if the user press the "Validate" button OR to save the page if he press the "Save" button.

Unfortunately it doesn't work anymore since, when I press the Validate button, nothing happens!
I tried to use the "insert button" functionnality of the Visual Editor, but since I need to check different "values" of the current page, and to assign the description value it doesn't work because they are not accessible in the server code. Any idea?
Button #2

In the Visual Editor tab of the Add page, in HTML mode, I added the following code after the Save button code:

<SPAN class=buttonborder><INPUT id=submit3 class=button value="Save and add details" type=submit name=submit3></SPAN>


In the AfterAddevent, I check the "requester" like this:

if ($_REQUEST["submit3"]=="Save and add details")

{

header("Location: actions_list.php?mastertable=jobs&masterkey1=".$values["JOB_ID"]);

}

else

{

header("Location: jobs_list.php?a=return");

}

exit();


Again, when I press the button nothing happens.

I tried to change the "id=" content to "saveButton1", but then the redirection never works correctly...
Anyone can help?

B
BenjaminJ author 5/30/2011

I realy need some advices...

How can I have my project able to run again?

J
Jane 5/30/2011

Benjamin,
these buttons wont' work in PHPRunner 5.3 because form is created and submitted dynamically in this version. So you need to add new controls to the form manually in the JavaScript onload event on the Eventstab.

Here is a sample (check example for PHPRunner 5.3) how to save and redirect to another page:

http://www.asprunner.com/forums/topic/10748-adding-an-additional-button-to-the-edit-page/
I recommend you to create new custom button to validate values using Insert button option on theVisual Editor tab. Right click on the page and choose Insert button option.

Then you can access field values on the Client before or Client after tabs. Use JavaScript API for this purpose:

http://xlinesoft.com/asprunnerpro/docs/javascript_api.htm