Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2010
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    clear text field on submit

    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?

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    use javascript.

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

  • #3
    New Coder
    Join Date
    Mar 2010
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    this way it will clear the field before it submits the data to the php file :P

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •