Forms tag question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave F.

    Forms tag question

    Is it possible to access the value of a radio button or change a radio
    button to enabled/disabled without using the forms tags<FORM></FORM>? In
    other words is the forms tag required for these actions?

    Thanks,
    Dave F.


  • Hywel Jenkins

    #2
    Re: Forms tag question

    In article <n6jgb.166589$0 v4.12607681@bgt nsc04-
    news.ops.worldn et.att.net>, dfrazell@NOSPAM carefreeofcolor ado.com
    says...[color=blue]
    > Is it possible to access the value of a radio button or change a radio
    > button to enabled/disabled without using the forms tags<FORM></FORM>? In
    > other words is the forms tag required for these actions?[/color]

    If you have <input>s you need <form>. There's no reason to leave it
    out, is there?

    --
    Hywel I do not eat quiche


    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: Forms tag question

      Hywel Jenkins <hyweljenkins@h otmail.com> writes:
      [color=blue]
      > In article <n6jgb.166589$0 v4.12607681@bgt nsc04-
      > news.ops.worldn et.att.net>, dfrazell@NOSPAM carefreeofcolor ado.com
      > says...[color=green]
      > > Is it possible to access the value of a radio button or change a radio
      > > button to enabled/disabled without using the forms tags<FORM></FORM>? In
      > > other words is the forms tag required for these actions?[/color]
      >
      > If you have <input>s you need <form>.[/color]

      No. While Netscape 4 can't accept form controls outside of a form tag,
      the HTML specification allows them, and it works in all modern browsers.
      [color=blue]
      > There's no reason to leave it out, is there?[/color]

      Lots of reasons. A form element requires an action attribute. If you
      don't have a reasonable action to add, then it is a good sign that what
      you are doing isn't a form.


      For the original question: Yes, it is possible. You can access any
      element on the page. For form controls inside a form element, there is
      an extra way to access them: the form through the "forms" collection
      and the controls through the "elements" collection of the form.

      If you have an input element with no form, you must access it directly,
      so you should give it a unique identifier:
      <input type="text" value="my text" id="myInputId" >
      You can the access the value as
      document.getEle mentById("myInp utId").value

      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      Working...