This topic is locked
[SOLVED]

 Javascript Onload Event

1/22/2013 5:16:05 AM
PHPRunner General questions
E
epanc author

Hi,

I have 2 fields in a form - ceckbox, date - the date field should be visible only if the field ceckbox is true. with the following code, the opposite happens:
var = ctrlcancel Runner.getControl (pageid, 'cancel');

var ctrldate_cancel = Runner.getControl (pageid, 'date_cancel');

Â

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

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

ctrldate_cancel.show ();

else {}

ctrldate_cancel.hide ();

}

});
I tried several changes but do not work. Does anyone know the solution?

Thank you.

C
cgphp 1/22/2013

There are a lot of syntax errors in your code. Check it before to make a build of the project. Check the following solution:

var ctrlcancel = Runner.getControl(pageid, 'cancel');

var ctrldate_cancel = Runner.getControl(pageid, 'date_cancel');



ctrlcancel.on('click', function(e) {

if(this.getValue() == 'on')

{

ctrldate_cancel.show();

}

else

{

ctrldate_cancel.hide();

}

});
E
epanc author 1/22/2013

Perfect,

I have made only a small addition.

In fact, with your code to open the form the "date" field was visible,

so this is the code that I use:
var ctrlcancel = Runner.getControl(pageid, 'cancel');

var ctrldate_cancel = Runner.getControl(pageid, 'date_cancel');

ctrldate_cancel.hide();
ctrlcancel.on('click', function(e) {

if(this.getValue() == 'on')

{

ctrldate_cancel.show();

}

else

{

ctrldate_cancel.hide();

}

});
Thanks Cristian.