How to control the order in which forms are displayed

S

Supreme

Hello! I am trying to structure the order of a series of forms that
make up one record. Basically, I would like to detect the day of the
week, and based on the day send the end user to a particular form,
followed by another particular form, etc.,. The logic would be...

if(Monday)
form1 (submit)-> form2 (submit)-> form3 (submit)-> form4 (submit)->
Thanks page
else if(Tuesday || Thursday)
form2 (submit)-> form4 (submit)-> Thanks page
else
form1 (submit)-> form3 (submit)-> Thanks page

Is javascript the best way to accomplish this? How? Any help is
greatly appreciated. Thanks!
 
R

Richard Cornford

Supreme said:
Hello! I am trying to structure the order of a series of forms
that make up one record. Basically, I would like to detect the
day of the week, and based on the day send the end user to a
particular form, followed by another particular form, etc.,.
The logic would be...

if(Monday)
form1 (submit)-> form2 (submit)-> form3 (submit)->
form4 (submit)-> Thanks page
else if(Tuesday || Thursday)
form2 (submit)-> form4 (submit)-> Thanks page
else
form1 (submit)-> form3 (submit)-> Thanks page

Is javascript the best way to accomplish this? How? Any
help is greatly appreciated. Thanks!

Client side javascript, no, server side javascript (most commonly
server-side JScript in ASP), yes.

To attempt this client-side would introduce a completely avoidable
dependence on an optional technology and the results would be needlessly
unreliable.

A server side script would be quite capable of writing the URL into the
action attribute on whichever form it was outputting based on whatever
criteria you chose. But exactly how would depend on your choice of
server-side language/approach and would be off topic here. Unless the
implementation was server-side javascript/JScript in which case you
would probably want to use the date information available to create a -
Date - object, where:-

var dt - new Date();

- would return the current date and time (on the server) as a Date
object, and:-

var weekDay = dt.getDay();

- or -

var weekDay = (new Date()).getDay();

- would assign the current day of the week to the - weekDay - variable
as a number in the range 0 to 6 where zero was Sunday. And then use that
number as the basis for the decision.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top