This topic is locked

javascript in After Record Added event

3/26/2008 5:35:32 AM
PHPRunner General questions
G
giles author

I'm having an issue with activating a javascript in an After Record Added event in an _add record page...
I load the javascript using an AddOnLoad event using

echo '<script src="myscript.js"></script>';
This script contains a function "myfunction()"
I can call this function successfully from a code snippett embedded in the page using:

echo '<script type="text/javascript"> jobsched() </script>';
But when I try to use the same mechanism to call it from an After Record event I get an "Object expected" error.
I can call a simple javascript echo '<script type="text/javascript"> alert("Fred") </script>'; from that event.
Why is this?

G
giles author 3/26/2008

Just a correction to the above...
The call is to "myfunction()" not to "jobsched()"

J
Jane 3/26/2008

Hi,
try to add all your code to the After record added event.

echo '<script src="myscript.js"></script>';

echo '<script type="text/javascript"> myfunction(); </script>';

G
giles author 3/26/2008

Hi Jane,

That worked perfectly.

<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=27334&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' /> Whatever they're paying you it's not enough!
Giles.