Forum Moderators: open

Message Too Old, No Replies

Javascript Multiple Functions on Submit

Extra Code on auto-generated form

         

Mr_Brutal

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

10+ Year Member



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

Bernard Marx

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

WebmasterWorld Senior Member 10+ Year Member



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','');"

Mr_Brutal

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

10+ Year Member



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 :-)

john_k

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

WebmasterWorld Senior Member 10+ Year Member



if(!(checkCombo()))return false;

Mr_Brutal

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

10+ Year Member



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!