Forum Moderators: open
...
<textarea cols="24" rows="3" name="message"></textarea>
...
<input type="submit" name="s" value="Submit" onClick="document.f.message.value='';">
Where f is the name of the form in question. This little bit of javascript ends up clearing the message field and then posting the results instead of the other way around. Is there any way to get the form submission and then have the message field cleared?
Change the submit button to a BUTTON type. Then point the OnClick even to a JavaScript function that looks something like this:
function myfunc() {
document.f.submit();
document.f.message.value="";
}
The other way to solve it is to have the document in the other frame clear the field.
parent.name_of_frame.document.f.message.value="";
The document loaded in the other frame is actually part of a separate domain, I tried this solution and IE at least complained to me about security and killed the javascript request.
Any other ideas or is this impossible given the new constraints?
1) When the other frame has loaded, let it reload (or load a new page) in the first frame (using 'parent.name_of_frame.location.href')
2) in the OnClick for the submit button, do something like OnClick="setTimeOut('myFunc()',1000)" and use this script:
function myFunc() {
document.f.message.value = "";
}
That way there's a 1000 millisecond delay before the form is cleared, and the form should've been posted by then.