onsubmit

onsubmit

am 15.01.2008 02:37:36 von Chris

I have two onsubmits I'd like to include in my 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?

onSubmit="return checkform()">

Thanks,
Chris

Re: onsubmit

am 15.01.2008 03:30:58 von Adrienne Boswell

Gazing into my crystal ball I observed Chris
writing in news:91776f54-5df8-42a3-a381-0f521ecc5791
@u10g2000prn.googlegroups.com:

> I have two onsubmits I'd like to include in my 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?
>
> > onSubmit="return checkform()">
>
> Thanks,
> Chris
>

The way to do it is to name the submit buttons, name="submit1" value="Submit 1">
and


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

Re: onsubmit

am 15.01.2008 04:13:17 von jeff

Chris wrote:
> I have two onsubmits I'd like to include in my 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?
>
> > 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:


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

Jeff

>
> Thanks,
> Chris

Re: onsubmit

am 15.01.2008 13:23:01 von Toby A Inkster

Jeff wrote:

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

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.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 15 days, 23:32.]

GPS & Cameras
http://tobyinkster.co.uk/blog/2008/01/14/gps-cameras/

Re: onsubmit

am 15.01.2008 14:10:43 von David Dorward

Toby A Inkster wrote:
> 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/

Re: onsubmit

am 15.01.2008 16:23:21 von Toby A Inkster

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.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 16 days, 2:35.]

GPS & Cameras
http://tobyinkster.co.uk/blog/2008/01/14/gps-cameras/

Re: onsubmit

am 15.01.2008 18:01:04 von David Dorward

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.



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

Re: onsubmit

am 15.01.2008 22:29:40 von Neredbojias

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

> 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.

Re: onsubmit

am 15.01.2008 23:58:36 von jeff

David Dorward wrote:
> 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
>
>
>

Re: onsubmit

am 16.01.2008 11:10:05 von Toby A Inkster

Neredbojias wrote:

> Dont forget document.getElementById("...")... That's the one I just
> luuuv typing.

That's not a 1:1 equivalent to an HTML attribute though.

..className and .httpEquiv differ from the heuristic that I mentioned
earlier (all DOM properties that have a one-to-one mapping to HTML
attributes are lower case) out of necessity:

* "class" is a reserved word in JavaScript.

* "http-equiv" contains a hyphen which would be interpreted
as subtraction.


You are right about .bgColor though. How annoying. Come to think of
it, .aLink,.vLink and .accessKey. Most of these correspond to deprecated
attributes though.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 16 days, 21:12.]

Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatrici ana/