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 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. 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] 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"> 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. 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 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. 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. 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! 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. 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! Link to comment https://forums.phpfreaks.com/topic/30452-disable-a-text-field/#findComment-141363 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.