This topic is locked
[SOLVED]

 if on javacript not working

12/2/2011 4:39:40 AM
PHPRunner General questions
author

Hi
I have this code in my Javascript on load event in PHPrunner 6 on the add page. if the test_mail check box is ticked I do not want the message to be showed but it always ignores my if clause
What am I doing wrong?
var ctrlmail = Runner.getControl(pageid, 'test_mail');

if(ctrlmail.getValue()!=1){

this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

if (confirm('Please check all the details are correct as an automatic email will be sent to the selected suppliers inviting them to quote'))

return true;

else

return false;

});}
Thanks

C
cgphp 12/2/2011
var ctrlmail = Runner.getControl(pageid, 'test_mail');

if(ctrlmail.getValue() != 'on'){

this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

if (confirm('Please check all the details are correct as an automatic email will be sent to the selected suppliers inviting them to quote'))

return true;

else

return false;

});}
7542 12/2/2011

Thanks, Just tried that. It now ignores the message if the box is ticked or not the field is tinyint and I am using mysql
Regards
Richard

C
cgphp 12/2/2011
var ctrlmail = Runner.getControl(pageid, 'test_mail');

this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

if(ctrlmail.getValue() != 'on')

{

if (confirm('Please check all the details are correct as an automatic email will be sent to the selected suppliers inviting them to quote'))

return true;

else

return false;

}

else

{

return true;

}

});
7542 12/2/2011



Thanks, Just tried that. It now ignores the message if the box is ticked or not the field is tinyint and I am using mysql
Regards
Richard


Great thanks. That worked.