GetDotted Domains

Viewing Thread:
"PHP and HTML Forms"

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.

Sun 27/04/03 at 21:51
Regular
Posts: 787
It has come to my attention that the reset button will not function if the value field has been set within the HTML Code, as opposed to when the user enters the information themself (I can't believe I never knew that).

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.
Tue 29/04/03 at 19:57
Regular
"It goes so quickly"
Posts: 4,083
Bingo :)

The 'return false' was needed, simple one liner.

Thanks again.
Tue 29/04/03 at 17:10
Regular
"Devil in disguise"
Posts: 3,151
cjh wrote:
> 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.
Tue 29/04/03 at 15:07
Regular
"It goes so quickly"
Posts: 4,083
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.
Tue 29/04/03 at 14:11
Regular
"Chavez, just hush.."
Posts: 11,080
Yes...

(What was that about?!)
Tue 29/04/03 at 12:20
"I hate that!!!"
Posts: 4,115
or if you can be bothered you can delete all posts manually
Tue 29/04/03 at 09:58
Regular
"Devil in disguise"
Posts: 3,151
cjh wrote:

> It seems as though the 'value' attribute within hte > overrides the JavaScript instructions. Yet, if the user enters data,
> 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.
Mon 28/04/03 at 22:40
Regular
"It goes so quickly"
Posts: 4,083
onreset is a valid event handler :)

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.
Mon 28/04/03 at 21:01
Regular
"You've upset me"
Posts: 21,152
Hmmm. Is onreset() really an event handler? And even if it is I think the word reset is a 'reserved' word, so you won't be able to use it in a function name. Try this:

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.
Sun 27/04/03 at 22:48
Regular
"Chavez, just hush.."
Posts: 11,080
*walks into thread and makes random comment*

Is it me or are the Freeola clocks still waiting to be updated from DST?
Sun 27/04/03 at 22:16
Regular
"It goes so quickly"
Posts: 4,083
Thats what I've got, but in a .js file:



in the JS File:
function Reset() {
var Reset = confirm('Are you sure you want to clear the details you\'ve entered???');

if (Reset) {
document.Contact.Name.value = "";
document.Contact.Email_Address.value = "";
document.Contact.Subject.value = "";
document.Contact.Comments.value = "";
return true;
} else {
return false;
}
}

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

The coolest ISP ever!
In my opinion, the ISP is the best I have ever used. They guarantee 'first time connection - everytime', which they have never let me down on.
Everybody thinks I am an IT genius...
Nothing but admiration. I have been complimented on the church site that I manage through you and everybody thinks I am an IT genius. Your support is unquestionably outstanding.
Brian

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.