473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

html form --> vbscript

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
4 4869
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ricki Susic | last post by:
Hi, Can anyone tell me if it is possible to call a function from a html form, where the function is included in the same file as the form. <html> <body> <form method="post" action="what...
3
by: Megha Vishwanath | last post by:
Hi, I have a struts form <html:form> in which although the focus rests on the submit button, hitting the enter key does not submit the form. I tried capturing the Enter key event and followed...
6
by: Angus Comber | last post by:
Hello I can run a command as below: start www.iteloffice.com this launches my web browser and opens up the url www.iteloffice.com What I want to do is open a particular web page and then...
6
by: snacktime | last post by:
I've searched and searched and have not found a solution to suppress the margin on form or href tags so that there is no space before or after the tag. The only way I have found to do this is to...
2
by: Shawn H | last post by:
Hi guys, I'm experiencing this really strange issue with a HTML form, because no data gets posted. Basically, everything is written in ASP. Firstly, a user fills in an online (ASP) form, and...
2
by: bcanter | last post by:
I have a PHP form that submits information via e-mail, I know that it work fine. My problem is that I want a msgbox to pop up when you submit the form and I can't seem to make it work. I want the...
19
by: Coward 9 | last post by:
HI, I saw in an example hello.aspx, there is a <form tagbeing used like <form runat="server> I search all html tag references and could NOT find "runat" attributes for <formtag. which...
1
by: nikhilchandra | last post by:
how clear text field in struts onsubmit event of <html:form> tag
1
by: jpenguin | last post by:
This should be simple, but I'm stuck <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('joshdye', $con);
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.