Fog Juice Posted March 3, 2008 Share Posted March 3, 2008 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? Quote Link to comment Share on other sites More sharing options...
almystersv Posted March 3, 2008 Share Posted March 3, 2008 You can make a text box read only using form functions in php. Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 3, 2008 Share Posted March 3, 2008 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. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 4, 2008 Share Posted March 4, 2008 Create a copy of the information in a type="hidden" field. Quote Link to comment Share on other sites More sharing options...
Fog Juice Posted March 4, 2008 Author Share Posted March 4, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.