"Supreme" <su*****@scs.howard.edu> wrote in message
news:5a*************************@posting.google.co m...
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.