473,804 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="resulta ten.asp">

<select name="keuze">
<option value="leeg">ma ak 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">m aak 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="verzende n">

</form>
<script language="VBScr ipt">
<!--
Sub verzend_OnClick ()
If (document.enque te.keuze.Value = "leeg") Or
(document.enque te.mening.Value ="start") Or
(document.enque te.paramtext.va lue="") 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 4886
"nathalia" <te*******@hotm ail.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="verzende n">
becomes
<input type="button" name="verzend" value="verzende n">

Then use this

Sub verzend_OnClick ()
If (document.enque te.keuze.Value = "leeg") Or
(document.enque te.mening.Value ="start") Or
(document.enque te.paramtext.va lue="") 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.enquet e.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*******@hotma il.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.publi c.inetsdk.progr amming.scriptin g.vbscript>

--
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******* *******@tk2msft ngp13.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="verzende n">
becomes
<input type="button" name="verzend" value="verzende n">

Then use this

Sub verzend_OnClick ()
If (document.enque te.keuze.Value = "leeg") Or
(document.enque te.mening.Value ="start") Or
(document.enque te.paramtext.va lue="") 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.enquet e.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
21699
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 do I write here to acces function test()"> <input type="text" name="tekst">
3
11683
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 it by the document.form.submit() but this takes me through the validation attached with the submit twice( giving me all the alerts twice). Here's the code
6
5839
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 insert some text into a field in an HTML form. Is there any way to do this.
6
3879
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 place the tags one after another without any spaces between them. For example, a space gets rendered between these two href's when displayed in firefox or IE. <a href="#"><img border="0" height="10" src="test.gif" width="10" /></a>
2
2510
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 then submits it to another ASP page (e.g. Send.asp). Now Send.asp retrieves all the form data and sends another HTML form via an e-mail. I then receive and open the HTML email(s). Now everything is going fine up until this point.
2
2120
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 form to be sent no matter what the answer is to my msgbox, if they answer yes then it will open a window with another form, if they answer no then the msgbox goes away. Right now I'm not sure how to get the form action to respond to the part that mails...
19
2157
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 reference should I use in order to find that?
1
6486
by: nikhilchandra | last post by:
how clear text field in struts onsubmit event of <html:form> tag
1
2469
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
9576
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10311
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.