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 1856 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...
|
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...
|
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>...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
| |
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: 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...
|
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,...
|
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...
|
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...
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |