what's the difference, URL in FORM tag and in INPUT tag

Discussion in 'Javascript' started by john woo, Jun 29, 2005.

  1. john woo

    john woo Guest

    Hi

    I'm not good at javascript and wondering the difference, URL in FORM
    tag and in INPUT tag.

    ex
    1.
    <FORM name="Form1" id="InputForm" method="post" action="url">
    <INPUT TYPE="HIDDEN" NAME="nn" VALUE="">
    2.
    <form name="Form2">
    <table ID="SelectPanelTable"...>
    <tr> <TD ID="TD".. onmouseup=function()>
    3.
    <FORM name = "Form3">
    <INPUT TYPE=Hidden NAME="aa"
    4.
    <FORM name = "Form4" onsubmit=url>
    <INPUT TYPE=Hidden NAME="aa"..>
    5.
    <FORM name = "Form5" onsubmit=url>
    <INPUT TYPE=button NAME="aa"..>

    questions from above cases:
    1. when need to use "action"
    2. different in 4 and 1?
    3. if no button, how to triger submit?
    4. the where/how to specify URL, in <form> tag or in its sub-tag?
    5. when use onclick, onsubmit,onmouse to direct next page?

    --
    Thanks lots
    John
    Toronto
     
    john woo, Jun 29, 2005
    #1
    1. Advertising

  2. john woo wrote:

    > 1.
    > <FORM name="Form1" id="InputForm" method="post" action="url">
    > 4.
    > <FORM name = "Form4" onsubmit=url>


    > 1. when need to use "action"


    Every time you use a form. Its a required attribute.

    > 2. different in 4 and 1?


    1 is sane.

    4 attempts to treat a URL as some unspecified client side scripting (most
    browsers will treat it as JavaScript, but you should specify this
    explicitly http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.2 (of
    course URLs aren't JavaScript so this will just break))

    > 3. if no button, how to triger submit?


    http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html
    (But its always a good idea to have a submit button)

    > 4. the where/how to specify URL, in <form> tag or in its sub-tag?


    The action attribute of the <form>.

    > 5. when use onclick, onmouse to direct next page?


    Its almost always a very bad idea to submit forms using anything other then
    then a regular submit button with no need for client side scripting.

    > 5. when use onsubmit to direct next page?


    Never. Use this to stop the form being submitted when certain conditions are
    or are not met with client side code (but don't depend on it working)

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Jun 29, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    947
  2. jakk
    Replies:
    4
    Views:
    12,612
  3. shruds
    Replies:
    1
    Views:
    941
    John C. Bollinger
    Jan 27, 2006
  4. David Wright

    input attribute for the input tag?

    David Wright, Dec 19, 2006, in forum: HTML
    Replies:
    1
    Views:
    354
    Jukka K. Korpela
    Dec 20, 2006
  5. André
    Replies:
    2
    Views:
    794
    André
    Jun 23, 2008
Loading...

Share This Page