views:

29

answers:

1

We have validation rules in an external JS file that is being called via jQuery getScript:

$.ajaxSetup({async:false});
$.getScript('scripts/validation/createPosting.js', function(){ checkFoapalPercentage(); });
$.ajaxSetup({async:true});

The script works fine in all other browsers (Firefox, Chrome, and Safari).

Any idea why we're getting a Javascript error (Object expected) on a line that's referencing a method in the external JS file?

Thanks.

A: 

Your question doesn't have nearly enough info in it ... Where is checkFoapalPercentage defined (in createPosting.js)? What does it return? Which line is throwing the error?

I think you mean checkFoapalPercentage is defined in createPosting.js, in which case the error could be because IE is (correctly) trying to refer to an as-yet-undefined function.

If you post some more info, I'll give it a whirl.

Sir Robert
checkFoapalPercentage is defined in createPosting.js. However, the line that is throwing the error is from the first javascript file, and here's the code:
droidy
$(":submit").click(function() { //h:commandButton tinyMCE.triggerSave(); var $formId = "#" + $(this).parents("form").attr("id"); if ($formId == $createPostingFormId) { validateCreatePostingForm($formId); }});
droidy
the validateCreatePostingForm() is where the error is being thrown in IE. this function is defined in createPosting.js.
droidy
it turned out that the callback function to checkFoapalPercentage() was the cause of the issue. thanks!
droidy
Sure -- glad I could help =)
Sir Robert