austine_power007 Posted December 13, 2006 Share Posted December 13, 2006 How can i disable a text field so that user can only see data but can't change it Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/ Share on other sites More sharing options...
.josh Posted December 13, 2006 Share Posted December 13, 2006 with plain old html:[code]<INPUT disabled name="fred" value="stone">[/code]moving to html forum. Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-140235 Share on other sites More sharing options...
Zane Posted December 13, 2006 Share Posted December 13, 2006 and there's also readonly[code]<input readonly name='fred' value='stone'>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-140256 Share on other sites More sharing options...
ToonMariner Posted December 13, 2006 Share Posted December 13, 2006 for compliance you shoudl use<INPUT disabled="disabled" name="fred" value="stone"> Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-140372 Share on other sites More sharing options...
obsidian Posted December 13, 2006 Share Posted December 13, 2006 The nice thing about all these is that they are able to be updated through javascript as well, so if you choose to lock down certain fields based on other criteria, you can do it whenever you like. Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-140380 Share on other sites More sharing options...
.josh Posted December 13, 2006 Share Posted December 13, 2006 [quote author=ToonMariner link=topic=118415.msg484043#msg484043 date=1166017127]for compliance you shoudl use<INPUT disabled="disabled" name="fred" value="stone">[/quote]really?http://www.w3.org/TR/html4/interact/forms.html#adef-disabled Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-140508 Share on other sites More sharing options...
obsidian Posted December 13, 2006 Share Posted December 13, 2006 [quote author=Crayon Violent link=topic=118415.msg484179#msg484179 date=1166031873][quote author=ToonMariner link=topic=118415.msg484043#msg484043 date=1166017127]for compliance you shoudl use<INPUT disabled="disabled" name="fred" value="stone">[/quote]really?http://www.w3.org/TR/html4/interact/forms.html#adef-disabled[/quote]I believe that HTML 4.01, as you suggest CV, will accept it either way, but in [b]XHTML[/b], it would require a value provided for each attribute of an element. Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-140525 Share on other sites More sharing options...
pr0x Posted December 14, 2006 Share Posted December 14, 2006 Also if you plan on posting the form value, and you want the disabled input box, and you try to post the form, the data won't go through, but with a readonly input box, the data will transfer through the post. Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-140859 Share on other sites More sharing options...
ToonMariner Posted December 14, 2006 Share Posted December 14, 2006 Excellent point pr0x - I forgot about that one! Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-141063 Share on other sites More sharing options...
Daniel0 Posted December 14, 2006 Share Posted December 14, 2006 People can just "unlock" it again with javascript. Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-141133 Share on other sites More sharing options...
ToonMariner Posted December 14, 2006 Share Posted December 14, 2006 that is why you always check the info sent in your processing script! Quote Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-141363 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.