Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Can this be done? How?


Message #1 by "Jonathan Gravois" <wynnewade@t...> on Wed, 19 Sep 2001 19:15:55 -0500
I am already using an onSubmit function in this ultradev-created insert form

to verify if the Password and resubmitted Password match. Using "<input

type="hidden" name="AccessLevel" value="1">", I am setting a field in the

record. My specs changed and now I have to differentiate between in-area and

out-of-area visitors (a textbox named County input has choices of our

counties or "Out of Area"). I need to make AccessLevel 2 unless County 

"Out of Area". Where can I put it and how can I trigger it since my onSubmit

trigger is already used?



<FORM ACTION="<%=MM_editAction%>" METHOD="POST" NAME="frmRegister"

	onSubmit="return VerifyData()">



Thanks,

Jon



Message #2 by Greg Griffiths <griffiths@x...> on Fri, 21 Sep 2001 17:21:41 +0100
You could do this in Javascript by adding the following in your onSubmit 

routine



if (frmRegister.Country.value=="Out of Area")

{

         frmRegister.AccessLevel.value=1;

}

else

{

         frmRegister.AccessLevel.value=2;

}



If you wish to use ASP then try something like



AccessLevel = Request.Form("AccessLevel")

Country = Request.Form("Country")



if (Country="Out of Area") then

         AccessLevel=1

else

         AccessLevel=2

end if



At 06:32 20/09/01 +0100, you wrote:

>I am already using an onSubmit function in this ultradev-created insert form

>to verify if the Password and resubmitted Password match. Using "<input

>type="hidden" name="AccessLevel" value="1">", I am setting a field in the

>record. My specs changed and now I have to differentiate between in-area and

>out-of-area visitors (a textbox named County input has choices of our

>counties or "Out of Area"). I need to make AccessLevel 2 unless County 

>"Out of Area". Where can I put it and how can I trigger it since my onSubmit

>trigger is already used?

>

><FORM ACTION="<%=MM_editAction%>" METHOD="POST" NAME="frmRegister"

>         onSubmit="return VerifyData()">

>

>Thanks,

>Jon
Message #3 by "Jonathan Gravois" <wynnewade@t...> on Fri, 21 Sep 2001 22:19:14 -0500
OK, Using JavaScript, I added to the onSubmit as follows:



 	function VerifyData()

		{

			if (frmRegister.County.value=="Out of Area") &&

(frmRegister.School_ID.value==99)

			{

         frmRegister.AccessLevel.value=1;

			}

			else

			{

         frmRegister.AccessLevel.value=2;

		}



			if (document.frmRegister.Password.value !

document.frmRegister.VerifyPassword.value)

			{

				alert ("Your passwords do not match - please reenter");

				return false;

			}

			else

				return true;

			}



BUT...



Remember that I had this in the form <input type="hidden" name="AccessLevel"

value="1">, so it still put 2 in the database. When I changed that line to

<input type="hidden" name="AccessLevel"> and then it puts nothing into the

database. What am I missing?



Jon



-----Original Message-----

From: Greg Griffiths [mailto:griffiths@x...]

Sent: Friday, September 21, 2001 11:22 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Re: Can this be done? How?





You could do this in Javascript by adding the following in your onSubmit

routine



if (frmRegister.Country.value=="Out of Area")

{

         frmRegister.AccessLevel.value=1;

}

else

{

         frmRegister.AccessLevel.value=2;

}



XXX CLIPPED



At 06:32 20/09/01 +0100, you wrote:

>I am already using an onSubmit function in this ultradev-created insert

form

>to verify if the Password and resubmitted Password match.

Using "<input

>type="hidden" name="AccessLevel" value="1">", I am setting a field in the

>record. My specs changed and now I have to differentiate between in-area

and

>out-of-area visitors (a textbox named County input has choices of our

>counties or "Out of Area"). I need to make AccessLevel 2 unless County 

>"Out of Area". Where can I put it and how can I trigger it since my

onSubmit

>trigger is already used?

>

><FORM ACTION="<%=MM_editAction%>" METHOD="POST" NAME="frmRegister"

>         onSubmit="return VerifyData()">

>

>Thanks,

>Jon



Message #4 by Greg Griffiths <griffiths@x...> on Sat, 22 Sep 2001 15:21:40 +0100
Try the following test code :



function VerifyData()

{

         alert(document.frmRegister.AccessLevel.value)

         if ((document.frmRegister.County.value=="Out of Area") && 

(document.frmRegister.School_ID.value==99))

         {

                 document.frmRegister.AccessLevel.value=1;

         }

         else

         {

                 document.frmRegister.AccessLevel.value=2;

         }

         alert(document.frmRegister.AccessLevel.value)



         if (document.frmRegister.Password.value != 

document.frmRegister.VerifyPassword.value)

         {

                 alert ("Your passwords do not match - please reenter");

                 return false;

         }

         else

         {

                 return true;

         }

}





At 22:19 21/09/01 -0500, you wrote:

>         function VerifyData()

>                 {

>                         if (frmRegister.County.value=="Out of Area") &&

>(frmRegister.School_ID.value==99)

>                         {

>          frmRegister.AccessLevel.value=1;

>                         }

>                         else

>                         {

>          frmRegister.AccessLevel.value=2;

>                 }

>

>                         if (document.frmRegister.Password.value !

>document.frmRegister.VerifyPassword.value)

>                         {

>                                 alert ("Your passwords do not match - 

> please reenter");

>                                 return false;

>                         }

>                         else

>                                 return true;

>                         }






  Return to Index