Hi i had a web form with an input text area in it I need to give some restrictions to user in that text area.

1. Need to deny users to type "<",">" these symbols in that text area.
2. Also deny from type more than 400 characters...

I used php to make that web page...

Please Help me .. Thanks

try using a javascript function for on key press, which would let the user know if a restricted key was pressed.

Sorry Sid, if i post one this on, just got late and am just trying to help...

All conditional statement can be extended with external or inline script --

<textarea rows="5" cols="40" onkeyup="try{if(this.value.match(/\,/)){alert('This (,) character is not allowed on this field'); this.value='';}else  if(this.value.length>=10){window.location.reload();}}catch(e){/* This is just a demo! */};"></textarea>

Sorry Sid, if i post one this on, just got late and am just trying to help...

<textarea rows="5" cols="40" onkeyup="try{if(this.value.match(/\,/)){alert('This (,) character is not allowed on this field'); this.value='';}else  if(this.value.length>=10){window.location.reload();}}catch(e){/* This is just a demo! */};"></textarea>

lol!! you missed one very simple think that i miss too alot of times!!:

<textarea rows="5" cols="40"  onkeyup="javascript: try{if(this.value.match(/\,/)){alert('This (,) character is not allowed on this field'); this.value='';}else  if(this.value.length>=10){window.location.reload();}}catch(e){/* This is just a demo! */};"></textarea>

you forgot to add javascript after onkeyup for what you are trying to do there is execute a javascript function!

Lol! I didnt see that one... And it should've been a textbox not a textArea... Thanks anyway and good day to you, sid...

And
validate the form on submit,
and if any field fails validation
you send the form back for correction/resubmit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.