This topic is locked
[SOLVED]

 Hidding field and graphic

5/20/2020 4:30:43 AM
PHPRunner General questions
B
Bernie author

part of form
I have a form with a checkbox then a second field to select type
I would like to Hide the type field and the graphic if the checkbox is left unticked
In my before display field I have:
$pageObject->setProxyValue("gloves",$pageObject->getMasterRecord(gloves));
In my Javascript Onload event I have:
if(proxy['yourCheckboxName']==Yes){

pageObj.showField("gloveN");

}

else

{

pageObj.hideField("gloveN");

}
var ctrlHideMe = Runner.getControl(pageid, 'gloves');
ctrlHideMe.on('change', function(e) {
if (this.getValue()=='Yes'){
pageObj.showField("gloveN");

pageObj.show_image(image1);
} else {
pageObj.hideField("gloveN");

pageObj.hide_image(image1);
}
//Control reset

if (this.getValue()=='off'){
}

else {
var ctrlReset = Runner.getControl(pageid, 'gloveN');

ctrlReset.clear();
}})

N
Nir Frumer 5/20/2020

hi

try this:
if(proxy['gloves']){
hope it helps,

B
Bernie author 5/21/2020

Many thanks
sometimes you can stare at something all day and not see it
Yes the filed is now hiding
However, It still does not affect the image I am trying to hide as well

Sergey Kornilov admin 5/21/2020

How do you display that image? Is this also coming from the database?

B
Bernie author 5/22/2020

No although I guess I could do it that way then use same code?
At the moment the image is embedded into the form as an image file

Sergey Kornilov admin 5/22/2020

hideField() is specifically designed to hide database fields. If you need to hide something else check this article:

https://xlinesoft.com/phprunner/docs/toggleitem().htm