By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,645 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,645 IT Pros & Developers. It's quick & easy.

html form --> vbscript

P: n/a
Hello,
I think i want a simple thing but don't know how to fix it.

I have a html form and i want to check if people didn't left any
fields blank. If they leave it black i want to show a message and stay
on the same page. I can show the message but it always go's to the
page i have put in mijn "action" of the html form.

Here is the code;

<form name="enquete" method="post" action="resultaten.asp">

<select name="keuze">
<option value="leeg">maak een keuze</option>
<option>via een andere website</option>
<option>via school</option>
<option>via vrienden familie</option>
<option>op een andere manier</option>
</select>
<select name="mening">
<option value="start">maak een keuze</option>
<option>Leuk</option>
<option>Gaat wel</option>
<option>Niet leuk</option>
</select>
<textarea name="paramtext" cols="100" rows=5
collumns=50></textarea>

<input type="reset" name="leegmaken" value="reset">
<input type="submit" name="verzend" value="verzenden">

</form>
<script language="VBScript">
<!--
Sub verzend_OnClick()
If (document.enquete.keuze.Value = "leeg") Or
(document.enquete.mening.Value ="start") Or
(document.enquete.paramtext.value="") then
Msgbox "u heeft geen antwoord gegeven op alle vragen"
//now my program may not send the form result because there
are not any
End If
End Sub
-->
</script>

thanks in advance
greets nathalia
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"nathalia" <te*******@hotmail.com> schrieb
Hello,
I think i want a simple thing but don't know how to fix it.

I have a html form and i want to check if people didn't left any
fields blank. If they leave it black i want to show a message and
stay on the same page. I can show the message but it always go's to
the page i have put in mijn "action" of the html form.

Here is the code;


The question has no relation to VB.NET. I think it is better placed in a
VBScript (or an ASP.NET?) group.
--
Armin

Nov 20 '05 #2

P: n/a
Hi Nathalia,

This may not be the official method but it woprks for me.

Change your submit button to an ordinary button.
<input type="submit" name="verzend" value="verzenden">
becomes
<input type="button" name="verzend" value="verzenden">

Then use this

Sub verzend_OnClick()
If (document.enquete.keuze.Value = "leeg") Or
(document.enquete.mening.Value ="start") Or
(document.enquete.paramtext.value="") then
Msgbox "u heeft geen antwoord gegeven op alle vragen"
'now my program may not send the form result because there are not any
values
Else
'now my program <will> send the form
document.enquete.submit
End If
End Sub

In other words your OnClick will do the submit only if the fields have
been given a value.

Regards,
Fergus
Nov 20 '05 #3

P: n/a
te*******@hotmail.com (nathalia) scripsit:
I have a html form and i want to check if people didn't left any
fields blank. If they leave it black i want to show a message and stay
on the same page. I can show the message but it always go's to the
page i have put in mijn "action" of the html form.


Notice that this is a VB.NET language group, but your question is
related to VBScript programming:

You may want to ask the question in this group:

<news://news.microsoft.com/microsoft.public.inetsdk.programming.scripting.vbs cript>

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

P: n/a
Thanks Fergus!

And sorry for posting it in the wrong group
greetings Nathalia

"Fergus Cooney" <fi******@tesco.net> wrote in message news:<uj**************@tk2msftngp13.phx.gbl>...
Hi Nathalia,

This may not be the official method but it woprks for me.

Change your submit button to an ordinary button.
<input type="submit" name="verzend" value="verzenden">
becomes
<input type="button" name="verzend" value="verzenden">

Then use this

Sub verzend_OnClick()
If (document.enquete.keuze.Value = "leeg") Or
(document.enquete.mening.Value ="start") Or
(document.enquete.paramtext.value="") then
Msgbox "u heeft geen antwoord gegeven op alle vragen"
'now my program may not send the form result because there are not any
values
Else
'now my program <will> send the form
document.enquete.submit
End If
End Sub

In other words your OnClick will do the submit only if the fields have
been given a value.

Regards,
Fergus

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.