Simple Javascript to Validate Form Data against Session Data

sulzener
sulzener used Ask the Experts™
on
I am new to javascript.  Can someone help me finish this?  I need some logic that will check a Form Variable a against a Session variable and then make sure that a Followup date was entered!

I do not know how to finish this logic:

function verifySubmit()
{
      if (document.forms.DetailMain.FollowupPerson.value ==
                          THE SESSION USER)

                 FORCE ENTRY OF A  FOLLOWUPDATE
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
like this

<cflock scope="session" type="readonly" timeout="10">

function verifySubmit()
{
    if (document.forms.DetailMain.FollowupPerson.value == <cfoutput>"#trim(SESSION.varname)#"</cfoutput>) {
            do whatever
    }
 
}

</cflock>

CJ
Commented:
where you say FORCE ENTRY OF A  FOLLOWUPDATE, i'm not sure exactly what you mean, but i'm thinking you want to alert the user and not allow the form to submit.  if so, you would do:

alert("You need to enter a follow up date.");
return false;

then you need to return true if the first statement was false.

then, in your onsubmit evenhandler (ie <form onsumbit="") you need to have return verifySubmit();

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial