473,779 Members | 2,053 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
12 2531
ba*****@yahoo.c om (cruiserweight) wrote:

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 gave one possible reason in my earlier post. Another is that your
way uses more code than the alternative.
I was to find a better way.


Change:
if ( good2go > 0) {
document.printf orm.submit();
return false;
}

to:
if ( good2go > 0) { return true; }

Change:
<form name="printform " method="post" action="print.h tml?menu=other" >
to:
<form name="printform " method="post" action="print.h tml?menu=other"
onclick="return validate();">

Change:
<noscript><p class="body"><i nput type="submit" value="Print Selected"
name="Print Selected" /></p></noscript>
<script type="text/javascript"><!--
document.writel n ("<div><a href=\"#\" onClick=\"retur n validate();\"
class=\"button\ ">Print Selected</a></div>");
// --></script>

to:
<p class="body"><i nput type="submit" value="Print Selected"
name="Print Selected" /></p>

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 #11
Brian <us*****@juliet remblay.com.inv alid> wrote in message news:<40******@ news-1.oit.umass.edu >...
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.


absolutely right.
Jul 20 '05 #12
Steve Pugh <st***@pugh.net > wrote in message news:<u2******* *************** **********@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.


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?


I believe this is the correct question. It benefits no one for 'some
users _not_ to have an instantly recognisable submit button'.

However, I'd really like to get away from, or at least explore,
options to the standard UI available through html. Overindulgent?
Perhaps a little. In this case, though, I will rework it to use the
onsubmit event handler as suggested and go with the admittedly
unnecessary javascript button.
Jul 20 '05 #13

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

Similar topics

18
2452
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
9457
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
1813
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
7831
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
4705
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
9632
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
10302
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
10136
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
9925
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
8958
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...
0
5372
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
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
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.