diabling fields on my form...

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

    diabling fields on my form...

    i am presenting a form to the user as a sample and DO NOT wish the user to
    make any changes !

    is it possible to loop throuh all my form items and disable them all except
    Next and Prev submit buttons ?

    many thanks

    Mel


  • Randy Webb

    #2
    Re: diabling fields on my form...

    Mel wrote:[color=blue]
    > i am presenting a form to the user as a sample and DO NOT wish the user to
    > make any changes !
    >
    > is it possible to loop throuh all my form items and disable them all except
    > Next and Prev submit buttons ?[/color]

    Instead of making them form elements, simply make them span/divs and use
    CSS to make them appear to be form elements.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    • Amir Hardon

      #3
      Re: diabling fields on my form...

      Mel wrote:
      [color=blue]
      > i am presenting a form to the user as a sample and DO NOT wish the user to
      > make any changes !
      >
      > is it possible to loop throuh all my form items and disable them all
      > except Next and Prev submit buttons ?
      >
      > many thanks
      >
      > Mel[/color]

      Why not using the readonly directive? for example:
      <input type="text" name="Hi" value="Hello world!" readonly>

      --
      Remove the 'dont_spam_me' and the dashes before mailing me.

      Comment

      • Mel

        #4
        Re: diabling fields on my form...

        thanks, i think your suggestion of readonly works better for me, since later
        on in the project i would like to enable them and not change
        much of the code

        Yours, Me


        "Amir Hardon" <ha-dont_spam_me-rdon@actcom.co. il> wrote in message
        news:newscache$ latsth$l1k$1@ln ews.actcom.co.i l...[color=blue]
        > Mel wrote:
        >[color=green]
        > > i am presenting a form to the user as a sample and DO NOT wish the user[/color][/color]
        to[color=blue][color=green]
        > > make any changes !
        > >
        > > is it possible to loop throuh all my form items and disable them all
        > > except Next and Prev submit buttons ?
        > >
        > > many thanks
        > >
        > > Mel[/color]
        >
        > Why not using the readonly directive? for example:
        > <input type="text" name="Hi" value="Hello world!" readonly>
        >
        > --
        > Remove the 'dont_spam_me' and the dashes before mailing me.[/color]


        Comment

        • Andrew Urquhart

          #5
          Re: diabling fields on my form...

          "Mel" <jmel@redolive. com> wrote in message
          news:85dd$4040a 2cf$44a7759e$17 858@msgid.megan ewsservers.com. ..[color=blue]
          > i am presenting a form to the user as a sample and DO NOT wish the[/color]
          user to[color=blue]
          > make any changes !
          >
          > is it possible to loop throuh all my form items and disable them all[/color]
          except[color=blue]
          > Next and Prev submit buttons ?[/color]

          Sure, find the correct form from the form collection, traverse the
          elements collection in that form, if the value of the 'type' property of
          a given element meets your criteria disable that element.

          One problem though is that if someone turns off javascript, or doesn't
          have that capability, then someone will eventually submit your form and
          then what happens? Better to disable the form controls through HTML
          attributes on the elements without using client-side script and change
          the form action to a page that explains why they can't submit the form
          and that it's only for display purposes. However, in general I'm not
          convinced that this is a good example of a user interface, could you
          perhaps instead explain to the user the details of the form without
          resorting to this complexity?
          --
          Andrew Urquhart
          - FAQ: http://jibbering.com/faq
          - Archive: http://groups.google.com/groups?grou...ang.javascript
          - Reply: https://www.andrewu.co.uk/about/cont...ject=Re%3A+clj


          Comment

          • Mel

            #6
            Re: diabling fields on my form...

            readonly seems to work fine for text and textarea, but not for radio,
            checkboxes and select pulldowns ?

            can you help ?

            thanks
            Mel


            "Amir Hardon" <ha-dont_spam_me-rdon@actcom.co. il> wrote in message
            news:newscache$ latsth$l1k$1@ln ews.actcom.co.i l...[color=blue]
            > Mel wrote:
            >[color=green]
            > > i am presenting a form to the user as a sample and DO NOT wish the user[/color][/color]
            to[color=blue][color=green]
            > > make any changes !
            > >
            > > is it possible to loop throuh all my form items and disable them all
            > > except Next and Prev submit buttons ?
            > >
            > > many thanks
            > >
            > > Mel[/color]
            >
            > Why not using the readonly directive? for example:
            > <input type="text" name="Hi" value="Hello world!" readonly>
            >
            > --
            > Remove the 'dont_spam_me' and the dashes before mailing me.[/color]


            Comment

            • Evertjan.

              #7
              Re: diabling fields on my form...

              Mel wrote on 28 feb 2004 in comp.lang.javas cript:
              [color=blue]
              > readonly seems to work fine for text and textarea, but not for radio,
              > checkboxes and select pulldowns ?
              >[/color]

              Input-Radio:

              use

              <input type=radio name=x disabled>

              or

              <input type=radio name=x disabled checked>

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • Thomas 'PointedEars' Lahn

                #8
                Re: diabling fields on my form...

                Amir Hardon wrote:
                [color=blue]
                > Mel wrote:[color=green]
                >> i am presenting a form to the user as a sample and DO NOT wish the user to
                >> make any changes ![/color]
                >
                > Why not using the readonly directive? for example:
                > <input type="text" name="Hi" value="Hello world!" readonly>[/color]

                "readonly" is not a directive, it is a boolean attribute. Thus
                it can be written as <... readonly="reado nly" ...>, which is BTW
                the required form for XHTML.


                PointedEars

                Comment

                Working...