This topic is locked
[SOLVED]

  Required Fields Based on Checkbox

4/7/2011 2:33:26 PM
PHPRunner General questions
S
scopley author

I'm running PHPRunner 5.1 Build 2675. Is there a way to make 2 fields required based on if a checkbox is checked or not? I've read about enabling and disabling fields using a javascript but I cannot find a way to add javascript code with the version of PHPRunner I have.
Any help would be greatly appreciated.
scopley

C
caz 4/8/2011

Hi scopley,
Don't really know about how to accomplish this is 5.1, but I have done something similar in version 5.3.
I suggest that you upgrade to the latest version phpRunner 5.3 as the javascript API/omload event (only in 5.3) is wicked makes doing what you want to do a snap.
Sergey and the runner team offer a really good deal on upgrading your latest version at a discounted price.
http://xlinesoft.com/phprunner/upgrade_guide.htm
For this really cheap price you also get 1 years world class support from the runner team.

So believe me it's a truly amazing deal.
The newer features in 5.3 are also well worth the price alone.
Here is piece of code that will should show you at least how to reference a check box and then do something else in my case I show/hide some fields based on the value of the checkbox.
With a little work you can include your own javascript in the html view of your page.
The Code is form the javascript onload event. So you will have to do it slightly different

-------------------

var ctrlONLYN = Runner.getControl(pageid, 'otherNeuron');
function func26() {

if (ctrlONLYN.getValue()=='on'){

document.getElementById("hidediv79").style.display="table-row";

}

else {

document.getElementById("hidediv79").style.display="none";

//Other NL specify reset

var ctrlReset101 = Runner.getControl(pageid, 'otherNeurologSpecify');

ctrlReset101.setValue(' ');

}

};
ctrlONLYN.on('click', func26);

}

---------------
Hope this helps.
Best wishes
Caz

G
Grissom 4/11/2011

Hi Caz,
I was looking for just like something you posted here but I have some difficulty understanding the code. Are you using tabs/sections? I am trying to show/hide 3 fields in add view depending on the checkbox value of a 4th field. Maybe you could shed some light here on your code details (page name, fields, etc.).
Thanx a bunch!
Chris

N
nti 4/11/2011



For this really cheap price you also get 1 years world class support from the runner team. So believe me it's a truly amazing deal.


Purchase of an PHPRunner license includes 90-day e-mail support service and free upgrades for one year.
http://xlinesoft.com/phprunner/register.htm
One full year would be great, however, 90 days is what we get.