Hello everyone.
Try this htm page, please: http://users1.titanichost.com/MiguelRivero61/
This is the code: -
-
<html>
-
-
<head>
-
-
<script language="javascript" type="text/javascript">
-
<!--
-
-
function Popup(larg,alte,url)
-
{
-
var w = screen.width;
-
var h = screen.height;
-
var x = Math.round(w / 2) - Math.round(larg / 2);
-
var y = Math.round(h / 2) - Math.round(alte / 2);
-
window.open(url,'','width='+larg+',height='+alte+',top='+y+',left='+x+'');
-
}
-
-
-
//-->
-
</script>
-
-
</head>
-
-
<body>
-
-
<form name="myform" action="">
-
-
<input name="data_ispezione" size="20">
-
-
<select class=blub size="1" name="Esito_ispezione"
-
onchange="var cc = this.options[this.selectedIndex].value;
-
if(cc=='2' && document.myform.data_ispezione.value!='')
-
{Popup(600,200,'Upload_db.asp')}else{alert('Inserire una data!')};">
-
-
<option>Seleziona</option>
-
<option value="1">Si</option>
-
<option value="2">No</option>
-
</select>
-
-
</form>
-
</body>
-
-
</html>
If the fields data_ispezione is empty and selected value "No" (2) in the select Esito_ispezione , should not see and open page Upload_db.asp.
Now all values selected in the select Esito_ispezione open the alert, why?
Gracias
MR
7 1861 acoder 16,027
Recognized Expert Moderator MVP
If I understand correctly, you don't want to open the pop-up when the select value is "2"/No or if no text has been input. Is that correct?
If I understand correctly, you don't want to open the pop-up when the select value is "2"/No or if no text has been input. Is that correct?
1) If field data_ispezione is empty and selected value "No" (2) in the select Esito_ispezione NOT open pop-up and OPEN alert "data empty";
2) If field data_ispezione is empty and selected value "Si" (1) in the select Esito_ispezione alert "data empty";
3) If field data_ispezione NOT is empty and selected value "No" (2) in the select Esito_ispezione OPEN pop-up;
thanks x your reply.
acoder 16,027
Recognized Expert Moderator MVP
To satisfy condition 2, you'll need to change the 'else' statement into an 'else if' statement, e.g. - else if(cc=='1' && document.myform.data_ispezione.value=='') {
-
alert('...');
-
}
By the way, it may be better to put the onchange code into a separate function to make things easier.
To satisfy condition 2, you'll need to change the 'else' statement into an 'else if' statement, e.g. - else if(cc=='1' && document.myform.data_ispezione.value=='') {
-
alert('...');
-
}
By the way, it may be better to put the onchange code into a separate function to make things easier.
Sorry but not working... - onchange="var cc = this.options[this.selectedIndex].value; else if(cc=='2' && document.myform.data_ispezione.value!=''){Popup(600,200,'Upload_db.asp')}else{this.selectedIndex=0; alert('Inserire una data!')};">
1) Field data empty: selected value 1 or value 2 in the select open the alert: IT'S OK
2) Field data NOT empty: selected value 2 in the select OPEN pop-up; IT'S OK
3) Field data NOT empty: selected value 1 in the select open the alert; IT'S WRONG because Field data is NOT empty...
acoder 16,027
Recognized Expert Moderator MVP
You haven't added the if statement to the else, but anyway what you should really be doing is checking the input field first, e.g. - onchange="var cc = this.options[this.selectedIndex].value; if(document.myform.data_ispezione.value=='') {this.selectedIndex=0; alert('Inserire una data!')} else if (cc=='2') {Popup(600,200,'Upload_db.asp')};">
You haven't added the if statement to the else, but anyway what you should really be doing is checking the input field first, e.g. - onchange="var cc = this.options[this.selectedIndex].value; if(document.myform.data_ispezione.value=='') {this.selectedIndex=0; alert('Inserire una data!')} else if (cc=='2') {Popup(600,200,'Upload_db.asp')};">
thanks genius !!!!
Bye
Viki
acoder 16,027
Recognized Expert Moderator MVP
Glad it's working. Sometimes you have to rethink what you're doing to make solving a problem a little easier.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tim |
last post by:
I've been working on this for over a week now, and just can't get this
figured out. Hoping one of you gurus can help me out here.
I have an xml data island that I'm representing on an htm page as an
expandable menu. Got that working, but now I need to add sorting and
searching abilities to the menu. I am hoping to do this with xsl but
can't get it to work.
Is this because of the way I've formed my xml, having the children
within the...
|
by: bin_P19 P |
last post by:
the code i have got is as follows and now im stuck
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Shopping Cart</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<link rel="StyleSheet" href="css/style.css" type="text/css">
|
by: x muzuo |
last post by:
Hi guys,
I have got a prob of javascript form validation which just doesnt work
with my ASP code. Can any one help me out please.
Here is the code:
{////<<head>
<title>IIBO Submit Page</title>
</head>
<style type="text/css">
|
by: Richard |
last post by:
I have tried to create a javascript puzzle where by the grid is filled
with numbers from 1 to 26 and another grid listed 1 to 26 where each
number relates to a letter. Once you figure out the number to letter
sequence in the 2nd grid, you fill all the squares labeled with that
number....poor explanation but the HTML will explain it!
What I can't seem to manage to work is getting the javascript to take
the selected letters and place them...
|
by: bloc |
last post by:
I am programming an interactive CV using xml, xslt and java script. The
page consists of a header which contains links to various 'sections' on
the xml cv, a left and right menu, and a central panel. The central
panel is intended to display the main content of the cv: when an anchor
is selected from the header then the detail is supposed to appear. The
javascript is supposed to select the appropriate section 'onclick' and
output it....
| |
by: firstcustomer |
last post by:
Hi,
Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that
someone will be able to point me to a ready-made solution to my
problem!
A friend of mine (honest!) is wanting to have on his site, a Javascript
Calculator for working out the cost of what they want, for example:
1 widget and 2 widglets = £5.00
|
by: monomaniac21 |
last post by:
hi i want to be able to trigger a javascript style popup alert in php
(i want a message displayed on the actual page) is this possible?
|
by: bhanubalaji |
last post by:
hi,
I am unable to disable the text(label) in javascript..it's working fine with IE,but i am using MOZILLA..
can any one help regarding this..
What's the wrong with my code?
I am sending my code here..
Thanks in Advance...
Regards
|
by: JLupear |
last post by:
My friend and I are trying to start a business and are writing a website of our own. We have been trying to create an online estimator and are having trouble with writing the javascript that is to handle the form data. I am having trouble capturing the form data for use using the onsubmit operator. We have written all of the options using list boxes using numbers as the values. I have attempted to create a user defined function to caculate...
|
by: Venturini |
last post by:
I am trying to put together a web page where the customer makes choices of products and is then given a total. I am extremely new to Javascript and have managed to get as far as I have from web searches for scripts and html and adapted them.
I need to know the principles of how to disable certain options based on other selections within the form. I have attached my script and html below to help.
For example of a customer selects (BASIC...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |