This topic is locked

Custom Button on the ADD page to open a SEARCH page with values fromthe form

2/15/2016 10:34:54 AM
PHPRunner General questions
G
gustavo author

Hello

I want to insert a custom button on the ADD page to open a SEARCH page using values of fields from the ongoing form
Example

Field COUNTRY : User get the data from a lookup

Field STATE: User get the data from a lookup dependent on Country

Field CITY: Here is where I want to add the button to open a link like:

"Aux_Cities_list.php?q=(CountryName~equals~COUNTRY) (StateName~equals~STATE)"
How can a I get the values of Country and State?
The reason I don't want to use a third lookup on Cities but a search page its because the so called Cities table has more than 100K records and slow down the application on a look up.

Thank you in advance for your advice.

Gustavo

Admin 2/15/2016

To get values of any field on that page use Javascript API:

http://xlinesoft.com/phprunner/docs/ctrl_getvalue.htm
You can use 1 instead of pageid while adding this code to button.

G
gustavo author 2/15/2016



To get values of any field on that page use Javascript API:

http://xlinesoft.com/phprunner/docs/ctrl_getvalue.htm
You can use 1 instead of pageid while adding this code to button.



Sergey,

Sorry to bother You. Can you please give an example to build the final link inside the button fetching the values into the variables an building a link like this: Aux_Cities_list.php?q=(CountryName~contains~COUNTRY)(ProvinceName~contains~STATE)

Thank You, Gustavo

Admin 2/16/2016

The closest we have is example #6 from http://xlinesoft.com/phprunner/docs/inserting_button.htm
Use similar technique in ClientAfter event to build the URL and to assign it to location.href.
For instance, result.record["CountryName"] will give you the current value of 'CountryName' field etc. In Javascript you can concatenate strings using + sign.