Server Side Script inside a client side script

Results 1 to 2 of 2

Thread: Server Side Script inside a client side script

  1. #1
    Join Date
    Dec 1969

    Default Server Side Script inside a client side script

    I have a text box and a button on a asp page. When the user clicks the button, I check to make sure it is numeric and then I want to post that information to a database. <BR><BR>How can you do this? I&#039;m totally confused and have been searching the net but I&#039;m getting more and more confused.

  2. #2
    Join Date
    Dec 1969

    Default RE: Server Side Script inside a client side script

    hi,<BR>u need to use javascript to check for the values in ur form before posting them. u can find help on validating forms in<BR><BR>u can also write a vbscript validation which is not prefered as client side scripting as it works mostly in IE browser only. <BR><BR>U can also check for the values after u post but before inserting using vbscript as server side validation language.<BR><BR>javascript u have this function to check for integer values.<BR><BR>function valph(ph)<BR>{<BR>var len;<BR>var field_name;<BR>var field_value;<BR>field_name=ph;<BR>field_value=ph.v alue;<BR>len=field_value.length;<BR>for(i=0;i&#060 ;=len-1;i++) <BR>{<BR> if((field_value.charAt(i)&#060;"0" &#124&#124 field_value.charAt(i)&#062;"9")) <BR> {<BR> alert("Enter only numbers for telephone number...");<BR> field_name.value="";<BR> field_name.focus();<BR> return false;<BR> }<BR>}<BR>return true; <BR>} <BR><BR>onSubmit of ur form call this fuction passing document.form.txtboxname as parameter to the function as<BR>&#060;form onSubmit="return valph(document.form.txt)&#039;"&#062;<BR><BR>if u want to use server side vbscript, u can check like<BR>isNumeric(trim(request.form("txtbox")))<BR ><BR>cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts