/    Sign up×
Community /Pin to ProfileBookmark

Create Form using Javascript

How to create forms, like survey forms using javascript. I cannot ask all my questions at once as they differ according to user’s answer. The tutorials and examples I found on the web are more to how to check whether user’s inputs are within numbers for the “phone”, which is not useful for my case.

My form is simple, the user will only submit an answer to every question, although there will be a few options given. Currently i am thinking of creating buttons with options on it and the user can click on the desired answer.

Then the page needs to refresh to the next question (as mentioned earlier, the question depends on the user’s answer to previous question. There will be no true or false answer.

What i have done currently is up to :
ask question 1, and created yes, no and maybe buttons, and different messages will appear in a pop up window according to user’s answer. This is NOT what I want, i want the page to refresh and proceed to next question instead of having pop ups. as I mentioned, there is no true and false answer. Every answer by the user is like a command to what question should be called next.

I appreciate it if you could show me some example codes.
Thanks.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@binarydakuNov 23.2011 — on the "onclick" event of option box (where you have set your alerts), set form action and submit your form.

example:
[CODE]
form1.action ="page1.html"
form1.submit()
[/CODE]
×

Success!

Help @cecilia81 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.16,
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,
)...