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? Link to comment https://forums.phpfreaks.com/topic/94184-how-do-i-get-a-value-from-a-disabled-textbox/ 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. Link to comment https://forums.phpfreaks.com/topic/94184-how-do-i-get-a-value-from-a-disabled-textbox/#findComment-482442 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. Link to comment https://forums.phpfreaks.com/topic/94184-how-do-i-get-a-value-from-a-disabled-textbox/#findComment-482443 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. Link to comment https://forums.phpfreaks.com/topic/94184-how-do-i-get-a-value-from-a-disabled-textbox/#findComment-482458 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. Link to comment https://forums.phpfreaks.com/topic/94184-how-do-i-get-a-value-from-a-disabled-textbox/#findComment-482485 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.