Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > what is <form> useful for?

Reply
Thread Tools

what is <form> useful for?

 
 
^AndreA^
Guest
Posts: n/a
 
      07-25-2008
On Jul 25, 3:50 pm, Tim Streater <(E-Mail Removed)> wrote:
> In article
> <(E-Mail Removed)>,
>
>
>
> "^AndreA^" <(E-Mail Removed)> wrote:
> > On Jul 25, 2:48 pm, Sherman Pendley <(E-Mail Removed)> wrote:
> > > "^AndreA^" <(E-Mail Removed)> writes:
> > > > With javascript I usually check if the fields are filled up correctly
> > > > and then I let javascript send them to the server, so I don't use the
> > > > form tag becuase I don't need it.

>
> > > > Is this method wrong?

>
> > > Yes. Your script should only stop the form submission if there's
> > > something wrong with the input. Keep in mind that some users will
> > > disable JS, so your server-side script should be prepared to handle a
> > > plain form submission that hasn't been "approved" by the JS.

>
> > > > Are there any downside I don't know?

>
> > > Not everyone allows JavaScript, of course. And you *will* get input
> > > from hacked pages and/or bots - count on it. "Never trust the client"
> > > should be the mantra of *every* network programmer. So, checking input
> > > in the client is a great way to add a convenience for users who allow
> > > it - but then check the input again, on the server, in case the client
> > > can't or won't do the job.

>
> > > sherm--

>
> > > --
> > > My blog:http://shermspace.blogspot.com
> > > Cocoa programming in Perl:http://camelbones.sourceforge.net

>
> > Sherman how can I control the form with javascript?

>
> > I mean, I write this:

>
> > <form name="input" action="plain_html_form.php" method="post" >
> > Username:
> > <input type="text" name="user"> <br />
> > Email:
> > <input type="text" name="email"> <br />

>
> > <input type="submit" value="Submit"> <br />
> > </form>

>
> > and then I tie a js event to the submit button.

>
> > So, when the user presses the button the js function starts, but also
> > the data is sent to the server... because pressing the button you
> > active two things simultaneously.

>
> > I'm sure there is a workaround...

>
> > Basically the question is:
> > how can I tie a js function to the form without breaking it?
> > how can I prevent the form to send data if js "says" there is
> > something wrong?

>
> > Actually were two questions, but they mean the same thing...

>
> > Andrea

>
> Don't use a submit button, use an ordinary one. Do your validation, and
> if all is OK do the submit from within js.


yeah, but we have just said that js could be disabled...
 
Reply With Quote
 
 
 
 
Sherman Pendley
Guest
Posts: n/a
 
      07-25-2008
"^AndreA^" <(E-Mail Removed)> writes:

> On Jul 25, 2:48 pm, Sherman Pendley <(E-Mail Removed)> wrote:
>> "^AndreA^" <(E-Mail Removed)> writes:
>> > With javascript I usually check if the fields are filled up correctly
>> > and then I let javascript send them to the server, so I don't use the
>> > form tag becuase I don't need it.

>>
>> > Is this method wrong?

>>
>> Yes. Your script should only stop the form submission if there's
>> something wrong with the input. Keep in mind that some users will
>> disable JS, so your server-side script should be prepared to handle a
>> plain form submission that hasn't been "approved" by the JS.
>>
>> > Are there any downside I don't know?

>>
>> Not everyone allows JavaScript, of course. And you *will* get input
>> from hacked pages and/or bots - count on it. "Never trust the client"
>> should be the mantra of *every* network programmer. So, checking input
>> in the client is a great way to add a convenience for users who allow
>> it - but then check the input again, on the server, in case the client
>> can't or won't do the job.
>>

>
> and then I tie a js event to the submit button.
>
> So, when the user presses the button the js function starts, but also
> the data is sent to the server... because pressing the button you
> active two things simultaneously.
>
> I'm sure there is a workaround...
>
> Basically the question is:
> how can I tie a js function to the form without breaking it?
> how can I prevent the form to send data if js "says" there is
> something wrong?


Tie an onsubmit handler to the form, instead of an onclick on a
button. If JS is allowed and the form handler returns false, the form
isn't sent. If the handler returns true, the form data is sent to the
action URL. If JS is disabled, the form behaves just like any other
non-JS form, and sends its data to the action URL.

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
 
Reply With Quote
 
 
 
 
Travis Newbury
Guest
Posts: n/a
 
      07-25-2008
On Jul 25, 3:23*pm, Neredbojias <me@http://www.neredbojias.net/_eml/
fliam.php> wrote:
> > --
> > Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
> > Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
> > Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
> > Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap

> ^ Childish indulgence.


actually playingt with usenet and on google ranking.
 
Reply With Quote
 
Raymond SCHMIT
Guest
Posts: n/a
 
      07-25-2008
On Thu, 24 Jul 2008 23:04:14 -0400, "Jonathan N. Little"
<(E-Mail Removed)> wrote:

>Travis Newbury wrote:
>> On Jul 24, 7:05 pm, "Jonathan N. Little" <(E-Mail Removed)> wrote:
>>> And when JavaScript is disabled?

>>
>> Then it breaks and the visitor has a decision to make...

>
>Poor choice of design implementation.


Ok, so ....you can you check if the fields are filled up correctly -
(before - treating the form in php) without using javascript ?
 
Reply With Quote
 
^AndreA^
Guest
Posts: n/a
 
      07-25-2008
On Jul 25, 11:17 pm, (E-Mail Removed) (Raymond SCHMIT)
wrote:
> On Thu, 24 Jul 2008 23:04:14 -0400, "Jonathan N. Little"
>
> <(E-Mail Removed)> wrote:
> >Travis Newbury wrote:
> >> On Jul 24, 7:05 pm, "Jonathan N. Little" <(E-Mail Removed)> wrote:
> >>> And when JavaScript is disabled?

>
> >> Then it breaks and the visitor has a decision to make...

>
> >Poor choice of design implementation.

>
> Ok, so ....you can you check if the fields are filled up correctly -
> (before - treating the form in php) without using javascript ?


Javascript OFF:
you send the data directly to the server because the js event can't
start, the browser doesn't even notice the event...

Javascript ON:
you check the fields with js and then, if everything is ok, you send
the data to the server...

Cheers Sherman!!!
Andrea
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      07-26-2008
In article
<(E-Mail Removed)>,
Travis Newbury <(E-Mail Removed)> wrote:

> On Jul 24, 11:13*pm, dorayme <(E-Mail Removed)> wrote:
> > Actually, where Travis is concerned, good on you, Jonathan, in getting
> > the good message out there. He is hoping we will tire and he will get
> > his post-modernist/free-market/each-to-his-own take on objectivity to
> > swamp the battlefield.

>
> There you go again dorayme, telling someone what I was thinking. You
> haven't a clue what I am thinking. I simply stated that when a
> visitor comes to a page that is not configured for their browser, they
> have to make a choice. Change the browser, or go away.


Given the constancy of your postings on this sort of thing, you are
meaning to make a more general point than simply telling us what is
blindingly obvious.

Why would you simply be telling everyone the bleeding obvious? O wait,
of course, I nearly forgot, you are demonstrating your continuing role
as Chief Guardian of the motherhood statement.

--
dorayme
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      07-26-2008
In article
<(E-Mail Removed)>,
Travis Newbury <(E-Mail Removed)> wrote:

> One man's "competent" is another man's fool. Someone you may see as an
> expert, I might see as an amateur.


Yes, of course, there is no fact of the matter, everything is relative
to everything else. That you see something one way does not in any way
mean you are wrong or superficial or uninformed or biased. Any attempt
to show otherwise is easily parried by you with more of the same
garbage. W hat is like to live in such an intellectual closed loop that
is in no way able to be influenced by anything outside? Is it an
interesting sort of vacuum?

--
dorayme
 
Reply With Quote
 
Travis Newbury
Guest
Posts: n/a
 
      07-26-2008
On Jul 25, 9:01*pm, dorayme <(E-Mail Removed)> wrote:
> Why would you simply be telling everyone the bleeding obvious? O wait,
> of course, I nearly forgot, you are demonstrating your continuing role
> as Chief Guardian of the motherhood statement.


Apparently it is not so obvious to everyone or I would not find the
need to state it.

--
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      07-26-2008
In article
<(E-Mail Removed)>,
Travis Newbury <(E-Mail Removed)> wrote:

> On Jul 25, 9:01*pm, dorayme <(E-Mail Removed)> wrote:
> > Why would you simply be telling everyone the bleeding obvious? O wait,
> > of course, I nearly forgot, you are demonstrating your continuing role
> > as Chief Guardian of the motherhood statement.

>
> Apparently it is not so obvious to everyone or I would not find the
> need to state it.
>


Care to be more specific? Do you think Jonathan Little is such an idiot
that he cannot see the bleeding obvious? He may be a guy who likes to be
'on message' at all times and not one to dissect your insinuations in
detail, but you must be living in a bubble if you don't know that he
knows that a surfer can either suck it or leave it with a webpage.

Can't you see that he pays you a compliment and is arguing against what
he thinks are deeper assumptions or positions?

He does not know what I know about you. You have no position, that what
we see is what we get, impossible-to-disagree-with motherhood
statements. He sees only your statements here. But I have men all over
the show reporting back to me and they tell me that you walk the streets
with sandwich boards, on the front of which is stuff like, "the world
will end tomorrow" and on the back of which there is stuff like "the
world will not end tomorrow".

You have been seen at the races betting on horses and quickly covering
your bets on the same horses. And grimly being happy to pay for the
slight loss in bookie rewards for the pleasure.

You have up 4 shrinks chasing after you at any one times begging you to
return to their couches...

You can't fool me Travis. But good luck with the others.

--
dorayme
 
Reply With Quote
 
Travis Newbury
Guest
Posts: n/a
 
      07-26-2008
On Jul 25, 10:55*pm, Neredbojias <me@http://www.neredbojias.net/_eml/
fliam.php> wrote:
> It's like being on the lesser side of a killfile...


Kill files are meaningless to the message poster.

--
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
Travis Newbury <http://travisnewbury.blogspot.com/> Flash Crap
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
useful setting in device manager (may be useful to know!) jameshanley39@yahoo.co.uk Computer Information 2 07-07-2008 04:28 PM
Windows Connect Now - still useful! =?Utf-8?B?U2ltb25NYWNrYXk=?= Wireless Networking 1 05-11-2006 08:15 PM
Upgrade from SOHO77 to 827 useful? Arnoud Helmantel Cisco 3 10-15-2004 02:13 AM
Useful VOIP tutorial link ShaperShifter Cisco 2 06-09-2004 11:15 PM
Is transaction-based debugging useful ? ben cohen VHDL 0 08-20-2003 02:03 AM



Advertisments