javascript:document.Myform1.submit()

Post here if your topic is about CSS HTML Validator but doesn't fit in another forum.
Walter Metzger
Rank II - Novice
Posts: 48
Joined: Tue Feb 26, 2008 12:57 pm
Location: Germany

javascript:document.Myform1.submit()

Post by Walter Metzger »

I was changing from Light Edition to Professional. A good idea with great help from Albert Wiersch. There is remaining this one thing under "General Accessibility" for my site http://www.koerperbehinderte-es.de/kontaktformular.html. Professional says: AI Internet Solutions recommends that "javascript:" links not be used because of accessibility problems that may occur when scripting is not supported or is turned off. .... This message is displayed only once.
I am no expert in java, so I cannot repair.

The reason why I have java her: The form is not be send by pressing "Enter" in the form, only by klicking the button "Absenden".

I hope, my problem can be understand.
Greetings
Walter
(from Germany, excuse my English)
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Post by Albert Wiersch »

I would recommend you use the standard form submit process if you want your site to be more accessible. Use an "input" tag with type="submit" to create a standard submit button in a form.

http://www.w3.org/TR/html401/interact/f ... edef-INPUT
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Walter Metzger
Rank II - Novice
Posts: 48
Joined: Tue Feb 26, 2008 12:57 pm
Location: Germany

javascript:document.Myform1.submit()

Post by Walter Metzger »

Albert, thank You,

with my construction

1. <td><a href="javascript:document.Myform1.submit();">
<img border="0" alt="absenden" title="An den Verein senden" src="anlage1/absend.gif" /></a></td>

do I get the following:
Cursor is in any field, the User is pressing Enter,
nothing happens - as wanted from me.

I have to click with the mouse on the button Absenden >>
and the send-procedure is starting (when all Main fields contain anything)

with other constructions

2. <td><input type="image" alt="absenden" name="absenden" title="An den Verein senden" src="anlage1/absend.gif" /></td>
or
3. <td><input type="submit" title="Ihre Eingaben werden entfernt" value="Send" /></td>

do I get the following:
Cursor is in any field, the User is pressing Enter
and the send-procedure is starting - this is not wanted from me.

Reason:
The pressing Enter can happen quickly. We want that the Users, most disabled persons, only send by click with the mouse on the button Absenden >>.

My construction (1.) has only now the accessibility problem.

Greetings
Walter
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Post by Albert Wiersch »

Hi Walter,

Thanks, I think I understand the issue. Users should press the 'Tab' key to change fields in a form, not the 'Enter' key.

My suggestions:

1. If this isn't a significant issue for you and your visitors, just leave it as it is. You should be able to disable the validator message if you want, but I would just ignore the message. As long as you understand what the issue is with using JavaScript, then the purpose of the message has been fulfilled.

2. Perhaps you can use the standard submit method and add a JavaScript form validation routine so if the user hits 'Enter', then a box will appear if the form is not complete. If users don't have JavaScript available, then this shouldn't be a significant issue. Of course form validation should also occur on the server.

3. Pressing 'Enter' to submit a form is the standard way to submit a form, so you may want to reconsider this even though it is not the wanted behavior. In fact, it is possible you are confusing people if 'Enter' doesn't work the way they expect it should (which is submit the form).
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Walter Metzger
Rank II - Novice
Posts: 48
Joined: Tue Feb 26, 2008 12:57 pm
Location: Germany

javascript:document.Myform1.submit()

Post by Walter Metzger »

Thank You Albert,

what You write ist absolutely correct without any exception.
Many thanks for Your answers.

My personal opinion is:
Tab and enter key are wellknown for people working with PC professional.
For other "normal people" the tab key is less preferred, some people do
remember or compare to the typewriter.

Perhaps, at any time or other a java-expert has an idea for the (little)
accessibility problem with "javascript:document.Myform1.submit()".

I is very interesting to use CSE HTML Validator pro.
Greetings
Walter (Spring ist coming soon in Germany, but today a bit snow too)