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?

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.