/    Sign up×
Community /Pin to ProfileBookmark

How to keep info typed in the field even if u backspaced?

Hi.. I’m new to javascript and currently learning. But I need help urgently regarding this as Imy boss wants me to get it done asap. Please help if you know how. Thank you.

It’s regarding an order form. How to keep the information that the customers haf filled in, intact, even when they backspaced? Coz currently my order form, when my customer click on submit and if they fill in wrongly, they will click backspaced, however, all the filled fields are no longer there anymore, which may cause more hassle. Please teach me or tell me wat’s the command to do tt? thank you

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@denJul 22.2004 — HI I'm also new html and javascript, however I maybe able to help I just need to ask a few questions.

OnSubmit does the order form go to a varyfication html where they view

the information they have typed?

Is there another submit button for them to finally varify

and another to go back?
Copy linkTweet thisAlerts:
@curL30authorJul 22.2004 — Theres three steps... 1) orderform,2)orderconfirm and 3)order process.

So wat i need to do is, if customers forget to fill in the quantity amount on the orderform n went ahead to click on the submit button on the orderform, I have to add in a new command that detect such mistakes, like if submit is = $0, it will remain on the orderform instead of going to ordercomfirm page. can u help? thanx
Copy linkTweet thisAlerts:
@Mr_JJul 22.2004 — What you need is a form validation script.

There should plenty about in the forums.

Take a look here as well.

www.huntingground.freeserve.co.uk/scripts/f_validate.htm
Copy linkTweet thisAlerts:
@denJul 22.2004 — hi curL30

Here is a script you can implement

<html>

<head>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

function checkFields() {

missinginfo = "";

if(document.form1.fname.value == "") {

missinginfo += "n - fname";

}

if (missinginfo != "") {

missinginfo ="_____________________________n" +

"You failed to correctly fill in your:n" +

missinginfo + "n_
__
__________________________" +

"nPlease re-enter and submit again!";

alert(missinginfo);

return false;

}

else return true;

}

// End -->

</script>

</head>

where form1 is type your form name

where fname is type your form input type name the stuff after name=

where value == "" you will need value =="$0"

this will alert them onsubmit

you can keep on adding

if(document.form1.fname.value == "") {

missinginfo += "n - fname";

}

to the script for different input fields

in your form tag you must put the following

onSubmit="return checkFields(this);

Hope this helps
Copy linkTweet thisAlerts:
@denJul 22.2004 — oops

should be this in your form tag

onSubmit="return checkFields(this)"

good luck ?
Copy linkTweet thisAlerts:
@curL30authorJul 23.2004 — Im totally a greenhorn in html, javascript and esp php types... though im slowly learning... hey den, i dun get ur script n Mr J, its not the validation prob...

Hmm... its realli hard to explain thru' here but i will try.. the website is www.chlorellashop.com... n under the headings for 'order', u will see the first orderform. From there, there's so many different types of packages to buy from, which means i can't validate those as required fields coz not all customers will buy all the package deals. Only the billing information are required fields.

so my problem here is, let's pic a senario, Mr Jones forgot to key in the quantity of the prdt that he wants to buy but he fill up all the billing information, and he click confirm. And when it go to the next page, there will be the word 'error' for the quantity field, so if he click back, to go back to the orderform to key in the quantity amount, all the billing info is gone and he has to key in all over again. Which will cause a great hassle for customers.

So either i get the command for the submit="$0" command, which i dun get it, or is there a command that keeps the info intact even if i go next page n den click back again.

I'm not tokin abt storing the infor so that whenever mr jones wants to order, its there... i hope ive made myself clear..

Thanks for helping...

im desperate
Copy linkTweet thisAlerts:
@denJul 23.2004 — It is a validation script however you do not have to validate each input field just the field that calculates the total amount

if it left at $0 obviously the person who selected an item to purchase

did something wrong and when they go to submit they will receive a

alert saying they have not entered something correctly.

you can change the message the alert reads to Please check your

information as it is not correct.

Got an error when using your link that you put in your last post.

Hope this helps
×

Success!

Help @curL30 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...