Welcome to WebmasterWorld Guest from 54.156.85.167

Forum Moderators: open

Message Too Old, No Replies

Javascript Multiple Functions on Submit

Extra Code on auto-generated form

     
10:28 am on May 12, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:July 14, 2003
posts:130
votes: 0


Hello all,

I have an annoying problem and after much research can only hope someone can help. I have to do some validation on some combo boxes, to this end i have written a function that works OK. The page that needs the validation is auto-generated by Oracle Portal so i have limited access, i have added the function through a template and then have added the function call to the onSubmit for the form, but there is already code for the onSubmit that i can't alter and have to work around.

onClick="checkCombo();if (validateWWVM19170(this.form)) do_event(this.form,this.name,1,'ON_CLICK','');"

The do_event() function subits the form if the built in vaildation is OK, i need to run checkCombo() and if its OK carry on if its not stop. At the moment if the validation fails and checkCombo() returns false it still continues to the built in validation. If i use return checkCombo() then even with success it won't continue and run its own vaildation. checkCombo() returns either true or false.

Any help much appreciated.

Thanks

1:29 pm on May 12, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2004
posts:2047
votes: 0


Are you allowed to do this?:

(don't break line)


onClick="if( checkCombo() && validateWWVM19170(this.form)) do_event(this.form,this.name,1,'ON_CLICK','');"
2:07 pm on May 12, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:July 14, 2003
posts:130
votes: 0


How i wish :-)

Unfortunately when adding my function call the generated code puts the <em>;itsfunction()</em> after whatever i type so no. I can't think of anyway to incorprate the ; in some code without having to add code to the end of line as well.

Cheers for trying though, i think i've decided its impossible. I hope thats not a too "defeatist" attitude for webmasterworld :-)

2:11 pm on May 12, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 3, 2003
posts:792
votes: 0


if(!(checkCombo()))return false;
2:32 pm on May 12, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:July 14, 2003
posts:130
votes: 0


I spoke to soon that is spot on! I'm so happy i'm bouncing :-)

Thank you so much, i hate JavaScript cos its so fiddly but that also equates to powerful and simple solutions which u just proved.

Cheers again!