|
-
Jul 16th, 2001, 04:44 AM
#1
Thread Starter
Addicted Member
Forms Collection??
How can I run through all the inputs in my form to validate them for the same condition?
Can I use the form.elements
Something like:
for i = 0 to form.elemets.count
if form.elements(i).value = "" then
window.alert "Enter data!"
end if
next
It gives me an error stating that object doesnt support this property. What is wrong or what other way is there to do it?
I Have alot of textboxes on my form and dont want to check each on inividualy!
-
Jul 16th, 2001, 04:52 AM
#2
Fanatic Member
Code:
For Each Item In Request.Form
If Len(Item) = 0 Then '//Item is Empty
'If Item.Value = "" Then - will work too, i think.
Alert "Enter Data!"
End If
Next
r0ach™
Don't forget to rate the post
-
Jul 16th, 2001, 04:55 AM
#3
Thread Starter
Addicted Member
I actually want to do it in client side script on my form_Onsubmit function so the request.form will not work
-
Jul 16th, 2001, 05:29 AM
#4
Fanatic Member
Sorry. I kinda copied that out of one of my pages.
Try Window.Form instead of Request.Form
r0ach™
Don't forget to rate the post
-
Jul 16th, 2001, 07:53 AM
#5
Lively Member
I see you are from South Africa. Where are u from ?
But here is the code.
Sub btn_click()
For each checkbox in document.formname
if checkbox.type = "checkbox" then
if checkbox.checked = true then
Msgbox Checkbox.ID & " is checked!"
End if
End if
End Sub
This will loop thru all the checkbox to see which one(s) is ticked. You can change it to any control on the form.
-
Jul 16th, 2001, 08:13 AM
#6
Fanatic Member
Sundance Kid:
Are you from SA? 'Cos if you are, then we all are! Hehehe
r0ach™
Don't forget to rate the post
-
Jul 16th, 2001, 08:24 AM
#7
Lively Member
Magtig... rerig. Are you guys Afrikaans or English? Where do you guys work?
-
Jul 16th, 2001, 08:40 AM
#8
Fanatic Member
Ek is afrikaans gebore, but my Fiancée is english so I'm bi-lingual.
noGuru is also from SA. He's a personal friend of mine. We (mainly me) are working on a cool website, which we'll upload when it's done.
I'm from Pretoria. You guys?
r0ach™
Don't forget to rate the post
-
Jul 16th, 2001, 08:46 AM
#9
Lively Member
Skop my krippel . Ek is ook van Pretoria. Centurion. What website do you guys work on?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|