The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
Anyway, I would like the reset function to work as normal, even if the value is set within the HTML (from passed values in PHP). However, I'd also prefer to have the page stay as it is, rather than having to be reloaded. How could I do this??
I've got a Javascript which I thought would work, but it doesn't. All it will do is remove any extra characters I may add to an already filled form field.
Any ideas???
Thank you for any help.
The 'return false' was needed, simple one liner.
Thanks again.
> Garin wrote:
> So basically make sure you return false from your function no matter
> what.
>
> Tried, but still didn't work. Thanks anyway.
>
> I suppose having it reload the page with black pre-defined values will
> have to do.
http://www.tarashaw.net/test.html
Try it. Works for me.
> So basically make sure you return false from your function no matter
> what.
Tried, but still didn't work. Thanks anyway.
I suppose having it reload the page with black pre-defined values will have to do.
(What was that about?!)
> It seems as though the 'value' attribute within hte
> that is wipped fine.
Well, in your function when you want to clear the form, you set all the fields, and then return true. Since you're returning true to an event handler, it then presumes its ok to execute that event and thus reset all the values back to the default ones. So basically make sure you return false from your function no matter what.
But, I tried your code too, which still didn't work, but thanks for trying.
I even alter the names in my original code, incase 'reset' was a reserved word, no luck.
It seems as though the 'value' attribute within hte tag just overrides the JavaScript instructions. Yet, if the user enters data, that is wipped fine.
Its only a problem because some links on my site come with 'pre-defined' subjects to be placed within the Contact Form, so I know what a particular E-mail is about, and saves the user having to fill in the data themself.
function formReset() {
var sureReset = confirm('Are you sure you want to clear the details you\'ve entered???');
if (sureReset)
{
document.Contact.Name.value = "";
document.Contact.Email_Address.value = "";
document.Contact.Subject.value = "";
document.Contact.Comments.value = "";
}
else
{
location.reload()
}
Using a button instead of a Reset means that you can have it run any script you want, and I also don't think you need the return true & false parts of the function. This script should simply set the values to blank or just reload the page, leaving the values as they are.
Is it me or are the Freeola clocks still waiting to be updated from DST?