Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check for blank fields in a form

Status
Not open for further replies.

chqdzn

Programmer
Jun 3, 2004
4
US
I'm a newbie to vbscript. I need to check my form for blank txtbox fields. I wrote a function using select case to check for correct quantity and type of data, so that once this info is correct, the cursor moves to the next txtbox and so on. however, i need to make sure my users enter data in the first place! :) How do i do this?

thanks in advance!
 
I wrote a function using select case to check for correct quantity and type of data
Can you show that code?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Here's a snippet. How do I check to make sure the boxes are not blank?

thanks in advance!


<script language="vbscript">
Function checkLength(n)
Select Case n
Case 3
if Len(document.Form1("txt1box").value) >= 3 then
if IsNumeric(document.Form1("rrtxt3box").value) Then
document.Form1("txt2box").focus()
Else
alert("Characters must be numeric")
'end if
end if
end if
end select
end Function
</script>
 
If document.Form1("txt1box").value = "" Then
'Handle it here
End If

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Thanks, TomThumbKP--
I tried that vbs statement at the start of this whole process, but it didn't work. When I use that statement, I lose the "jump-to-next-txtbox" (j2ntb) functionality, and the form still submits.

Where I'm finding the trouble is that my form is using a server-side (ss) submit control. I writing the app in asp.net because other controls on the form need to be handled by the server. I using vbscript for client-side (cs) scripting because there is no setfocus or focus control/method in asp.net yet to handle my j2ntb function.

Is there a vbscript/js written to work with an asp.net control, in this case, the submit button? [ponder]

Any suggestions/leads are greatly appreciated!

Thanks in advance!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top