Jump to content

form help


mike1313

Recommended Posts

I have a shoutbox form with <input type=text name=message><input type=submit name=say value=say>

 

then when I hit enter or Say it runs the form in an inline frame just refreshing the frame I want it so if they users hits enter to submit data, that the data gets submitted and as soon as it does it clears the message input so they can starting typing again right away.

 

How can I do this?

Link to comment
Share on other sites

add an id to the input field

<input type=text name=message id=message>

in the iframe, add an onload event

<iframe onload="document.getElementById('message').value=''; document.getElementById('message').focus();" .....

This should clear the input field and put the focus on it.

Link to comment
Share on other sites

thanks that works great but I have another question, ok my input box isnt inside an inline frame, and in one of my inline frames I have a normal text link. I want the user to be able to click on a link inside the iframe and upon doing so it will change the value of the input box thats not in a frame, possible to do this?

Link to comment
Share on other sites

Just use the "parent" window and it should work if both pages on the same domain

<a href="#" onclick="parent.document.getElementById('message').value = 'hello world'; return false;">Click here</a>

Change the "hello world" to anything you need, the return false will stop the page from jumping up.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.