liamloveslearning Posted June 8, 2010 Share Posted June 8, 2010 Hi all, I have a textarea which im inputting into my table, I have a selector of values which when clicked populate my textbox, however I need to prevent users from inputting there own text, Is there a simple solution to this ? Quote Link to comment https://forums.phpfreaks.com/topic/204198-prevent-user-typing-into-textarea/ Share on other sites More sharing options...
F1Fan Posted June 8, 2010 Share Posted June 8, 2010 You could use JavaScript, but why are you using a textarea for this? Why not use a span to display the data, and a hidden input if you need to pass the data through a form? Quote Link to comment https://forums.phpfreaks.com/topic/204198-prevent-user-typing-into-textarea/#findComment-1069517 Share on other sites More sharing options...
liamloveslearning Posted June 8, 2010 Author Share Posted June 8, 2010 How would I do this F1fan? sorry to be so naive, And Im awful with Javascript so I wouldnt know where to start Quote Link to comment https://forums.phpfreaks.com/topic/204198-prevent-user-typing-into-textarea/#findComment-1069518 Share on other sites More sharing options...
ignace Posted June 8, 2010 Share Posted June 8, 2010 Add readonly="readonly" However anyone with FF and Firebug can alter it's contents, and JS can be blocked. Never trust the client. Quote Link to comment https://forums.phpfreaks.com/topic/204198-prevent-user-typing-into-textarea/#findComment-1069521 Share on other sites More sharing options...
F1Fan Posted June 8, 2010 Share Posted June 8, 2010 ignace is right, you can't rely on JS, nor can you rely on readonly. However, if you use the method I suggested, it would at least make it more difficult, and less obvious, for users to circumvent it. I won't be able to help any further without seeing some code. Quote Link to comment https://forums.phpfreaks.com/topic/204198-prevent-user-typing-into-textarea/#findComment-1069522 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.