This topic is locked
[SOLVED]

 Help with checkbox

2/9/2012 5:36:47 PM
PHPRunner General questions
W
wildwally author

I've been pulling my hair out of my head for the past couple hours - that I'm beginning to get a headache (no joke).
I've found numerous items in the forums along the lines but the person(s) have left something out or the new version of phprunner works differently than what I'm finding. Not mention some of this stuff appears to be ASP.
I tried this a couple different ways and still no luck.
The first way I tried was creating a button and changing the button to a checkbox using code and instructions found here:
http://www.asprunner...r-client-after/
This worked good for creating the button and the label thing worked treffic too; however, I couldn't get the checkbox to do anything. I tried dumbing it down and simply posting a alert with no result. The second way I tried this was by creating a checkbox by creating a field as an alias. Which works nice but again i can't get the thing to do anything but look good.
What I want follows the lines of this topic here:
http://www.asprunner...-editadd-pages/
I have a field called State that is a lookup of U.S. states. I want to remove the required if the user checks the box signafying the project is not in the U.S. Sounds simple enough, but I can't figure it out.

C
cgphp 2/9/2012

Post your code.

W
wildwally author 2/9/2012


<script>

var ctrlCountry = Runner.getControl(pageid, 'checkbox');

var ctrlState = Runner.getControl(pageid, 'State');

ctrlCountry.on('change', function(e){

if (this.getValue() == '1'){

ctrlState.setEnabled();

ctrlState.addValidation("IsRequired");

}else{

ctrlState.setDisabled();

ctrlState.setValue("");

ctrlState.removeValidation("IsRequired");

}});

</SCRIPT>


Here is the last go around with a PHPRunner generated field alias as "checkbox". And the drop down field that is required is called "State". I've inserted this into the HTML page of the editor. Firebug says pageid is not defined??????

C
cgphp 2/9/2012

Check this article: http://xlinesoft.com/phprunner/docs/ctrl_getvalue.htm

Checkbox hold the value of 'on' if checked off and empty string if unchecked.

W
wildwally author 2/9/2012

I swear I tried that too. I guess between the combination of all my efforts it was all starting to run together. I was able to get it to work by removing it from the HTML code and adding it to the onload.

Have any way help to put this hair back in my head now? (LOL)
Thanks for the help, once again you come to the rescue.