473,769 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best-practice form checking

I've constructed this form so that if Javascript is disaabled it will
show a typical <input type="submit"> button, BUT using the <noscript>
tag. Why is this a problem and what's a viable solution? i'm not sure
of the best way to do this so help is very much appreciated; snide,
smartass, unhelpful comments are useless. Please keep them to
yourself.
Jul 20 '05 #1
12 2530
cruiserweight wrote:
I've constructed this form so that if Javascript is disaabled it
will show a typical <input type="submit"> button, BUT using the
<noscript> tag. Why is this a problem and what's a viable solution?
The question is why you've done this. Why is a submit button only
available in no-js situations?
snide, smartass, unhelpful comments are useless. Please keep them
to yourself.

Best not to cop an attitude, especially before you've gotten any help.

--
Brian (remove ".invalid" to email me)

Jul 20 '05 #2
ba*****@yahoo.c om (cruiserweight) wrote:
I've constructed this form so that if Javascript is disaabled it will
show a typical <input type="submit"> button, BUT using the <noscript>
tag.
What happens for users who do have JavaScript enabled? Do they get a
submit button at all?

In what way does it benefit some users _not_ to have an instantly
recognisable submit button?
Why is this a problem and what's a viable solution?
<noscript> is a blunt instrument. What if the user's browser supports
JavaScript but doesn't support all the individual parts that need to
be used to do whatever it is that you're doing?
i'm not sure
of the best way to do this so help is very much appreciated;


Write the form in HTML with a server side script that handles the
submission fully (including any checking that needs to be done).

Then add JavaScript on top of that to perform client side checking
(the time saved will benefit those who have JS enabled). This

JavaScript should be triggered via the onsubmit event handler of the
form (or equivalent event listener methods), not via the onclick event
handler of a particular button, etc.

This JavaScript should also be written so that the browser falls back
to submitting the form to the server in cases where the JavaScript can
not be processed - it should only ever not submit the form if a
definite error is detected in the data.

Technical questions on JS would be better directed to
comp.lang.javas cript

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Jul 20 '05 #3
ba*****@yahoo.c om (cruiserweight) wrote:
I've constructed this form so that if Javascript is disaabled it will
show a typical <input type="submit"> button, BUT using the <noscript>
tag. Why is this a problem and what's a viable solution? i'm not sure
of the best way to do this so help is very much appreciated; snide,
smartass, unhelpful comments are useless.
Is it being a smartass, and therefore useless, to bring to your
attention the fact that only a psychic can help you if you keep the
trouble-causing code a secret?
Please keep them to
yourself.


I'm so profoundly sorry for having wasted your time, but I couldn't
resist. May we now have *your* apologies for having wasted *our* time
by asking for help without providing relevant information?

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #4
Harlan Messinger <hm************ *******@comcast .net> wrote in message news:<7e******* *************** **********@4ax. com>...
ba*****@yahoo.c om (cruiserweight) wrote:
I've constructed this form so that if Javascript is disaabled it will
show a typical <input type="submit"> button, BUT using the <noscript>
tag. Why is this a problem and what's a viable solution? i'm not sure
of the best way to do this so help is very much appreciated; snide,
smartass, unhelpful comments are useless.


Is it being a smartass, and therefore useless, to bring to your
attention the fact that only a psychic can help you if you keep the
trouble-causing code a secret?
Please keep them to
yourself.


I'm so profoundly sorry for having wasted your time, but I couldn't
resist. May we now have *your* apologies for having wasted *our* time
by asking for help without providing relevant information?

Point well-taken. Apologies all around. The form is at
http://www.veiyotonle.com/printablem...enu=printables. I put a
regular submit button inside noscript tags, and then used javascript
to writeln the code for the javascript button. fields are checked in
javascript (if enabled) and on the server. I've read in these groups
recently, i forget where, that this is not a very good way to do
things. I was to find a better way. Again, sorry for the a-hole
comments.
Jul 20 '05 #5
"cruiserwei ght" <ba*****@yahoo. com> a écrit dans le message de
news:18******** *************** ***@posting.goo gle.com
I put a
regular submit button inside noscript tags, and then used javascript
to writeln the code for the javascript button. fields are checked in
javascript (if enabled) and on the server.


Err, why don't use the onSubmit event ? It works perfectly for non enabled
javascript ua as for enabled ones !

Please see :
http://devedge.netscape.com/library/...s.html#1121163

Jul 20 '05 #6
"Pierre Goiffon" <pg******@nowhe re.invalid> wrote:
"cruiserweight " <ba*****@yahoo. com> a écrit dans le message de
news:18******* *************** ****@posting.go ogle.com
I put a
regular submit button inside noscript tags, and then used javascript
to writeln the code for the javascript button. fields are checked in
javascript (if enabled) and on the server.
Err, why don't use the onSubmit event ?


The onsubmit attribute has nothing to do with whether a button is
drawn via Javascript or directly with HTML.
It works perfectly for non enabled
javascript ua as for enabled ones !
Assuming we *are* talking about onsubmit, Javascript certainly is
required for onsubmit to have any effect.

Please see :
http://devedge.netscape.com/library/...s.html#1121163


....where it says, "Executes JavaScript code when a submit event
occurs; that is, when a user submits a form." In other words,
Javascript has to be enabled for it to do anything.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #7
cruiserweight wrote:
I've constructed this form so that if Javascript is disaabled
it will show a typical <input type="submit"> button, BUT using
the <noscript> tag.
regular submit button inside noscript tags, and then used
javascript to writeln the code for the javascript button. fields
are checked in javascript (if enabled) and on the server.


Too complicated, and too prone to failure. Create a form using only
html, forget completely about js. Create whatever validation you need
on the server. When the form works perfectly without js, add a js
validation routine, and attach it to the form's onsubmit handler. Have
the routine return false if there's an error.

http://www.xs4all.nl/~sbpoley/webmatters/formval.html

--
Brian (remove ".invalid" to email me)

Jul 20 '05 #8
"Harlan Messinger" <hm************ *******@comcast .net> a écrit dans le
message de news:ho******** *************** *********@4ax.c om
Err, why don't use the onSubmit event ?


The onsubmit attribute has nothing to do with whether a button is
drawn via Javascript or directly with HTML.


Well I wrote my post a little to fast. As I understand it, but it's not
perfectly clear, it seems Cruiserweight is using writeln to had JavaScript
checks for his form. If this is it, it could be replaced by a function
called in the onSubmit event. In fact I was answering that because
unfortunately JavaScript validation that blocks non-enabled Javascript ua is
very common. Just what I guessed reading Cruiserweight.

By the way Cruiserweight, maybe you should explain exactly what is the
difference between the normal html submit button and what is written via JS
? Is it just Javascript validation, or is there another things ?

Jul 20 '05 #9
Oops forgot to say...

"Harlan Messinger" <hm************ *******@comcast .net> a écrit dans le
message de news:ho******** *************** *********@4ax.c om
Err, why don't use the onSubmit event ?


Javascript has to be enabled for it to do anything.


Yes exactly, but Cruiserweight said there are a client side checking via
JavaScript, plus a server side one :
fields are checked in
javascript (if enabled) and on the server.


Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2449
by: Roman Suzi | last post by:
;-) Just type into google "best programming language" and press (I am lucky) Sincerely yours, Roman Suzi -- rnd@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
15
2237
by: John J | last post by:
I've written the following code into a class to search for and display the results of all races entered (The complete code is in a previous thread). I wish to amend the code so as to display the best result only. Can anyone suggest a simple amendment to the following that will result in only the best result being displayed?
136
9447
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
20
11326
by: hagai26 | last post by:
I am looking for the best and efficient way to replace the first word in a str, like this: "aa to become" -> "/aa/ to become" I know I can use spilt and than join them but I can also use regular expressions and I sure there is a lot ways, but I need realy efficient one
3
4004
by: Irene | last post by:
Hi all, I have set up a simple VB program (and later on an ASP interface) to manage an Athletics database. I'm using Access 2000. To simplify, I have the Athlets, the Competitions and the Scores tables. When I want to list of the best scores/ranking, I just do:
5
1812
by: l.woods | last post by:
I want your recommendation on which ASP.NET Shopping Cart software I should buy? Best code Best documentation Best support (if needed. I will buying source code, if possible) TIA, Larry Woods
10
3482
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read somewhere that each folder under the "web site" is compiled in separate assembly. I however, did not find that the "web site" creation in vs.net 2005 created any AssemblyInfo.cs file.
24
2198
by: Earl | last post by:
I have all of my data operations in a separate library, so I'm looking for what might be termed "best practices" on a return type from those classes. For example, let's say I send an update from the UI layer to a method in a library class that calls the stored procedure. Best to return a boolean indicating success/failure, return a string with the exception message, or just return the entire exception?
9
7829
by: raylopez99 | last post by:
What's the best way of implementing a multi-node tree in C++? What I'm trying to do is traverse a tree of possible chess moves given an intial position (at the root of the tree). Since every chess position has around 30 moves, it would mean every node of the tree would have 30 branches (on average), which in turn themselves would average about 30 branches each. I can think of a variety of ways of implementing this, including a series...
11
4703
by: ankitmathur | last post by:
Hi, I'm trying to overcome a situation whereby I have to search through 4-5 columns and produce the results with an order by according to the values matched in these columns. Example: My Table Structure: Create Table TestPfx
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.