PDA

View Full Version : clear text field on submit



fael097
03-22-2010, 02:59 PM
hi, i have a chatbox that shows its result within an iframe, but the text field and the submit buttons are outside this iframe, so when i submit my form, its target is inside the iframe, so my text field wont clear itself. how to do that?

angst
03-22-2010, 03:15 PM
use javascript.



onClick="document.getElementById('ChatField').value = '';"

fael097
03-22-2010, 03:43 PM
this way it will clear the field before it submits the data to the php file :P

angst
03-22-2010, 03:48 PM
I would need to test it to know for sure, but it should submit the data before clearing.

otherwise use ajax to submit the query.