HighDots Forums  

onsubmit

alt.html alt.html


Discuss onsubmit in the alt.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris
 
Posts: n/a

Default onsubmit - 01-14-2008 , 07:37 PM






I have two onsubmits I'd like to include in my <FORM...> tag and
wanted to know before I go through the work of putting in all the code
if this is even allowed. And if not then how should I be calling it?

<FORM action="test.cgi" method="POST" onsubmit="csave()"
onSubmit="return checkform()">

Thanks,
Chris

Reply With Quote
  #2  
Old   
Adrienne Boswell
 
Posts: n/a

Default Re: onsubmit - 01-14-2008 , 08:30 PM






Gazing into my crystal ball I observed Chris <chris95008 (AT) yahoo (DOT) com>
writing in news:91776f54-5df8-42a3-a381-0f521ecc5791
@u10g2000prn.googlegroups.com:

Quote:
I have two onsubmits I'd like to include in my <FORM...> tag and
wanted to know before I go through the work of putting in all the code
if this is even allowed. And if not then how should I be calling it?

FORM action="test.cgi" method="POST" onsubmit="csave()"
onSubmit="return checkform()"

Thanks,
Chris

The way to do it is to name the submit buttons, <input type="submit"
name="submit1" value="Submit 1">
and
<input type="submit" name="submit2" value="Submit 2">

Then you check server side which submit got pressed.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share



Reply With Quote
  #3  
Old   
Jeff
 
Posts: n/a

Default Re: onsubmit - 01-14-2008 , 09:13 PM



Chris wrote:
Quote:
I have two onsubmits I'd like to include in my <FORM...> tag and
wanted to know before I go through the work of putting in all the code
if this is even allowed. And if not then how should I be calling it?

FORM action="test.cgi" method="POST" onsubmit="csave()"
onSubmit="return checkform()"
I'm going answer this, even though it's a rather dumb question and
off topic here, because I want you to have an answer. And I think most
here will misread the question. Next time post to comp.lang.javascript
after reading the FAQ there.

First, you can just call one javascript from inside the other, that's
the best way to do that.

otherwise:

<form onsubmit="csave();return checkForm()"...

You don't want two onsubmits, lowercase is correct here as it is for
form and action.

Jeff

Quote:
Thanks,
Chris

Reply With Quote
  #4  
Old   
David Dorward
 
Posts: n/a

Default Re: onsubmit - 01-15-2008 , 07:10 AM



Toby A Inkster wrote:
Quote:
In XHTML, yes; in HTML, the case of element and attribute names does not
matter, but using camelCase is not unusual for the event handling
attributes, to draw parallels with the usual Javascript coding style.
Ironically, while camelCase is the usual JS style, in the case of event
handlers, the DOM methods are lower case.

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/


Reply With Quote
  #5  
Old   
David Dorward
 
Posts: n/a

Default Re: onsubmit - 01-15-2008 , 11:01 AM



Toby A Inkster wrote:
Quote:
David Dorward wrote:

Ironically, while camelCase is the usual JS style, in the case of event
handlers, the DOM methods are lower case.

Indeed. IIRC, *all* DOM properties that have a one-to-one mapping to HTML
attributes are lower case.
Consistancy would be nice, but sadly ... *.className, meta.httpEquiv,
body.bgColor, and so on.



--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/


Reply With Quote
  #6  
Old   
Neredbojias
 
Posts: n/a

Default Re: onsubmit - 01-15-2008 , 03:29 PM



Well bust mah britches and call me cheeky, on Tue, 15 Jan 2008 17:01:04
GMT David Dorward scribed:

Quote:
Toby A Inkster wrote:
David Dorward wrote:

Ironically, while camelCase is the usual JS style, in the case of
event handlers, the DOM methods are lower case.

Indeed. IIRC, *all* DOM properties that have a one-to-one mapping to
HTML attributes are lower case.

Consistancy would be nice, but sadly ... *.className, meta.httpEquiv,
body.bgColor, and so on.
Dont forget document.getElementById("...")... That's the one I just luuuv
typing.

--
Neredbojias
Riches are their own reward.


Reply With Quote
  #7  
Old   
Jeff
 
Posts: n/a

Default Re: onsubmit - 01-15-2008 , 04:58 PM



David Dorward wrote:
Quote:
Toby A Inkster wrote:
David Dorward wrote:

Ironically, while camelCase is the usual JS style, in the case of event
handlers, the DOM methods are lower case.
Indeed. IIRC, *all* DOM properties that have a one-to-one mapping to HTML
attributes are lower case.

Consistancy would be nice, but sadly ... *.className, meta.httpEquiv,
body.bgColor, and so on.
I rather like it that way as those generally have dashes where the camel
is.

border-width -> borderWidth
background-color ->backgroundColor

It would be hard to program elsewise.

Jeff
Quote:



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.