creating a text box errors message for empty text box 
Author Message
 creating a text box errors message for empty text box

I am trying to create a form in which I have to enter
information into all the textboxes on the screen.  I want
to have an error message come up if the text box is left
empty.  I would love all the advice or code that you may
have.... Thanks a bunch
Jen


Sat, 03 Dec 2005 09:22:23 GMT  
 creating a text box errors message for empty text box
Client-side VB Script you mean?

<form onsubmit="return checkForm(this)">
<input name="txtSomething" type="text">
<input name="cmdSubmit" type="submit" value="Submit"
</form>
<script language="VBScript">
function checkForm(f)
 checkForm = True
  If Len(f.txtSomething.value) < 1 Then Msgbox "You need to enter
something.": checkForm = False
end function
</script>

Ray at home


Quote:
> I am trying to create a form in which I have to enter
> information into all the textboxes on the screen.  I want
> to have an error message come up if the text box is left
> empty.  I would love all the advice or code that you may
> have.... Thanks a bunch
> Jen



Sat, 03 Dec 2005 09:55:16 GMT  
 creating a text box errors message for empty text box
This will check a data array before sending it to the server and abort the
submission if there are empty boxes.

<input type=button value="Send" onClick=sender()>

<script language="vbs">
errormessage="All boxes must contain data."

sub sender()
error=false
for n=0 to document.all.formname.data.length-1
 if len(document.all.formname.data(n).value)=0 then
 error=true
 end if
next
if error then
 msgbox errormessage
else
 document.all.formname.submit
end if
end sub
</script>
--
Dave "Crash" Dummy - A weapon of mass destruction

http://lists.gpick.com



Sat, 03 Dec 2005 10:08:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. creating error messages for empty text boxes using VB

2. Text box text on new page text box

3. passing variables from a text box to a document.write text box

4. Event on Message box or text box from external app

5. using VB text boxes data but not text boxes in word 2000

6. Auto popluate text box with data from another text box

7. Columns in List box, when inserting text from text box (VBA)

8. update text box with a timer whilst editing same text box

9. Colour Text Box/Class Wrapper for Rich Text Box

10. Passing Data from VB App Text Box to a Web Page Text Box

11. Tabbing from text box to text box using the enter key

12. Text box to text box

 

 
Powered by phpBB® Forum Software