[Javascript] Passing an object and/or a form reference to afunction

dev at qroute.net dev at qroute.net
Fri Jul 9 13:14:12 CDT 2004


----- Original Message ----- 
From: "Flavio Gomes" <flavio at economisa.com.br>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Friday, July 09, 2004 11:03 AM
Subject: Re: [Javascript] Passing an object and/or a form reference to
afunction


> Both?
>
>  The form submit will be triggered when any of the submits on the form
> be pressed.
> But, if you have only one submit, in the end it'd be the same.
>   and you *can* do something like this:
>
> function Val(frmObject)
> {
>   alert(frmObject.value)
> }
>
> function Validate(frm)
> {
>  alert(frm.frmObject.value)
> }
>
> then
> =========//=========
> <form name=myForm onsubmit="Val(document.form.myInput)">
>   <input name=myInput />
>   <input type=submit onclick="Validate(document.form)"/>
> </form>
> =========//=========
>
> Will both work.
>
>
>
>
> ---
> Flavio Gomes
> flavio at economisa.com.br
>
>
>
> dev at qroute.net wrote:
>
> >How do you pass a form reference to a form validation function so that in
> >that function body I don't have to spell the whole thing as
> >
> >function Validate()
> >{
> >aValue = window.document.formNameHere.ObjectNameHere.value
> >}
> >
> >It'd better If I could do sometihng like
> >
> >function Val(frmObject)
> >{
> >aValue = frmObject.value
> >}
> >
> >and/or
> >
> >function Validate(frm)
> >{
> >aValue = frm.frmObject.value
> >}
> >
> >On the onSubmit event of a form , or on the onClick event of an object,
How
> >do you call the Validate function so the above idea can be realized ?
> >
> >
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list