This topic is locked
[SOLVED]

 OnLoad Javascript not firing

10/3/2010 11:47:26 PM
PHPRunner General questions
G
gawde author

Hello All, (vers 5.2 build 5482)

I have the following Javascript code in an OnLoad Add Event. It gets generated into the source code but appears to never get executed.
var ctrl1 = Runner.getControl(pageid, 'spar_id');

var ctrl2 = Runner.getControl(pageid, 'vehc_sparout');

/alert('change occured'); /
ctrl1.on('select', function(e){

ctrl2.addValidation("IsRequired");

});
While trying to debug this code I noticed there was a Javascript error occuring in generated code just preceeding my code.
Error source code => Cntrl.preload('','17');

Error msg = > Object doesn't support this property or method - vehicles_add.php, line 247 character 5
It seems this error is keeping my code from being reached but I don't know how or where to address the error.

Also, the field "spar_id" is a Lookup table selection box. I did see a previous post suggesting there was a problem with applying an OnLoad Javascript code to this type field. Has anyone seen or experienced this before?
A workaround would be helpful as well as I am very frustrated with this problem.
Thanks.

A
ann 10/4/2010

Greg,
select works for the text field only.

To make your code work use 'onclick' event:

var ctrl1 = Runner.getControl(pageid, 'spar_id');

var ctrl2 = Runner.getControl(pageid, 'vehc_sparout');

/*alert('change occured'); */
ctrl1.on('click', function(e){

ctrl2.addValidation("IsRequired");

});
G
gawde author 10/4/2010



Greg,
select works for the text field only.

To make your code work use 'onclick' event:

var ctrl1 = Runner.getControl(pageid, 'spar_id');

var ctrl2 = Runner.getControl(pageid, 'vehc_sparout');

/*alert('change occured'); */
ctrl1.on('click', function(e){

ctrl2.addValidation("IsRequired");

});



Ann,
Thanks for the reply. I tried the on 'click' event trigger and the result is same as before. No execution and Javascript error in unrelated code.
????
Greg

Sergey Kornilov admin 10/4/2010

Greg,
post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

G
gawde author 10/15/2010

Per Support at XlineSoft:
OnLoad Javascript code will not function on a page if that page also contains BeforeDisplay Event code to hide fields.
I suggested to Support it would be helpful if this limitation be resilved in a future version.
Greg