This topic is locked
[SOLVED]

 Set a default value in search page

8/15/2011 6:56:38 AM
PHPRunner General questions
P
plehmann author

hi all,

I want to set a default value in a search page in phprunner 5.3 (build 7113).
I have decided to use the "JavaScript OnLoad" event and added
->> document.formName.radioGroupName[indexNumber].checked;
to it after I had searched the forum for 2 hours (then, I gave up). I also added a form name <FORM name=myForm> to the SearchPage code and a </FORM> before </BODY>.
Then, I wrote this JavaScript OnLoad code:
->> document.myForm.radio_BASEUNITLENGTH_1[1].checked = true;
... and I works! I know, this is a rude coding because I have to maintain the index number.
Any help from your side?
best regards from Germany

Peter

Sergey Kornilov admin 8/16/2011

I recommend to check this article that explains how to manipulate search page controls using Javascript API:

http://www.asprunner.com/forums/topic/17529-automatically-search-between-dates-on-advanced-search-page/

P
plehmann author 9/17/2011



I recommend to check this article that explains how to manipulate search page controls using Javascript API:

http://www.asprunner.com/forums/topic/17529-automatically-search-between-dates-on-advanced-search-page/


Works! Great! Thank you!
var name='BASEUNITLENGTH';

var ctrl = Runner.getControl(pageid, name);

var d1 = '60';

ctrl.setValue(d1);

C
CK. 9/20/2011



Works! Great! Thank you!
var name='BASEUNITLENGTH';

var ctrl = Runner.getControl(pageid, name);

var d1 = '60';

ctrl.setValue(d1);


How about the value after you click on RESET button? It's go back to BLANK. not the default value your required.

C
cgphp 9/20/2011

Place the Sergey's code in a function and call it when the search page is loaded and when the reset button is clicked.