Jump to content

How do I get a value from a disabled textbox?


Fog Juice

Recommended Posts

Hey,

 

How can I get a value using $_POST from a disabled textbox? I have a script that disables a textbox once the information in it is correct, it is disabled via javascript in order to prevent the user from typing anything else in it, but my problem is that when I try to save the information from it using $_POST, it doesn't save. Is there a way to disable a textbox and still get information from it? Or is there a way to prevent users from entering any text into a textbox?

Link to comment
Share on other sites

I'm not enitrely sure of the inner workings, but a quick-fix would be to have javascript handle the submit for you...

 

When the submit button is pressed, trigger a javascript function that re-enables the field then submits the form.

Link to comment
Share on other sites

Umm it seems there was a database roll back, anyways, I found the solution.. I posted it earlier but it's gone.

 

Solution is to use javascript "document.getElementById(elem).readOnly = true;" to be able to get the value but disable user entry, or set to "document.getElementById(elemt).readOnly = false;" to allow user entry again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.