sending input value even if disabled

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

    sending input value even if disabled

    Hello,

    Is it possible to have a disabled input in a form whose value could be
    sent when the form is submitted.
    I just need the user not to be able to change the input value, but
    this value is significant and must be sent
    thanks for any help,
    G.
  • Martin Honnen

    #2
    Re: sending input value even if disabled



    lehmann wrote:
    [color=blue]
    > Is it possible to have a disabled input in a form whose value could be
    > sent when the form is submitted.
    > I just need the user not to be able to change the input value, but
    > this value is significant and must be sent[/color]

    Then use
    <input readonly type="text" name="inputName " value="Kibology ">
    or
    <input type="hidden" name="inputName " value="Kibology ">

    You script the readonly attribute as the
    element.readOnl y
    property with boolean values e.g.
    element.readOnl y = true;

    --

    Martin Honnen


    Comment

    • Michael Winter

      #3
      Re: sending input value even if disabled

      On 19 Jan 2004 07:32:41 -0800, lehmann <lehmann2@col.b sf.alcatel.fr> wrote:
      [color=blue]
      > Is it possible to have a disabled input in a form whose value could be
      > sent when the form is submitted.
      > I just need the user not to be able to change the input value, but
      > this value is significant and must be sent[/color]

      Not reliably. You could remove the disabled status just before sending the
      form, but without JavaScript, this method won't work.

      If the user doesn't need to see the data, you can store it in a hidden
      field. If you need the user to see the data, you can still display it in a
      disabled field, and keep the hidden and disabled values in sync.

      If the data is in an INPUT or TEXTAREA control, you could use the readonly
      attribute to prevent modification. Read-only controls are still submitted.

      Mike

      --
      Michael Winter
      M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

      Comment

      Working...