Hi there.
I have this form with three fields: - <HTML>
-
<HEAD>
-
-
<script language="javascript">
-
<!--
-
-
-
function ApriPopup(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 method="POST" action="test.asp">
-
-
<select size="1" name="Stato">
-
<option>Seleziona</option>
-
<option value="Assente">Assente</option>
-
<option value="Presente">Presente</option>
-
</select>
-
-
<select size="1" name="Stato_g">
-
<option>Seleziona</option>
-
<option value="Ferie">Ferie</option>
-
<option value="Malattia">Malattia</option>
-
<option value="In sede">In sede</option>
-
<option value="Fuori sede">Fuori sede</option>
-
</select>
-
-
<input type="text" name="ore" size="20">
-
<a href="javascript:ApriPoup(500,500,'popup.asp');">
-
<img border="0" src="apripopup.gif" width="12" height="12"></a>
-
-
</form>
-
-
</BODY>
-
</HTML>
-
-
I have to disable the field input type="text" name="ore" AND the link <a href="javascript :ApriPoup(500,500,'popup.asp');"> when the select "Stato" value "Assente".
Help please, thanks regards
Viki1967
17 2159 hsriat 1,654
Recognized Expert Top Contributor
Add a function onchange of Stato. In that function, if value of Stato is Assente, disable all the thing you require to disable, and if value is not Assente, enable them back.
You may not disable the link, so set its href to "#" or "javascript:void(0)" instead.
Thanks, but one example ?
hsriat 1,654
Recognized Expert Top Contributor - function disOrEnb(sel) {
-
document.forms[0].ore.disabled = sel.value == 'Assente' ? true : false;
-
document.getElementById('link').href = sel.value == 'Assente' ? 'javascript:void(0)' : 'javascript:ApriPoup(500,500,\'popup.asp\')';
-
}
Add onchange="disOrEnb(this)" to the select tag.
Thanks, but sorry not working: http://www12.asphost4free.com/viki1967/form.htm -
<HTML>
-
<HEAD>
-
-
<script language="javascript">
-
<!--
-
-
-
function ApriPopup(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+'');
-
}
-
-
-
function disOrEnb(sel) {
-
document.forms[0].ore.disabled = sel.value == 'Assente' ? true : false;
-
document.getElementById('link').href = sel.value == 'Assente' ? 'javascript:void(0)' : 'javascript:ApriPoup(500,500,\'popup.asp\')';
-
}
-
-
-
//-->
-
</script>
-
-
</HEAD>
-
-
<BODY>
-
-
<form method="POST" action="test.asp">
-
-
<select size="1" name="Stato" onchange="disOrEnb(this)">
-
<option>Seleziona</option>
-
<option value="Assente">Assente</option>
-
<option value="Presente">Presente</option>
-
</select>
-
-
<select size="1" name="Stato_g">
-
<option>Seleziona</option>
-
<option value="Ferie">Ferie</option>
-
<option value="Malattia">Malattia</option>
-
<option value="In sede">In sede</option>
-
<option value="Fuori sede">Fuori sede</option>
-
</select>
-
-
<input type="text" name="ore" size="20">
-
<a href="javascript:ApriPoup(500,500,'popup.asp');">
-
<img border="0" src="php/modifica.gif" width="12" height="12"></a>
-
-
</form>
-
-
</BODY>
-
</HTML>
-
-
hsriat 1,654
Recognized Expert Top Contributor
Make this change... <a id="link" href="javascript:ApriPoup(500,500,'popup.asp');">
I use Internet Explorer, this is error:
Stato = Presente
Stato_g = Ferie
If you click on image modifica.gif:
Yes !!! -
'javascript:ApriPoup(500,500,\'popup.asp\')';
-
-
'javascript:ApriPopup(500,500,\'popup.asp\')';
-
Not ApriPoup but ApriPopup
THANKS !!!!!!
Bye
Sorry, it's possible change image src="php/modifica.gif" with src="php/NoModifica.gif" when stato = Assente ?
hsriat 1,654
Recognized Expert Top Contributor
Sorry, it's possible change image src="php/modifica.gif" with src="php/NoModifica.gif" when stato = Assente ?
yeah, add this similarly to the existing function.
hsriat 1,654
Recognized Expert Top Contributor
Sorry, I dont know... :(
Here is an example which can help you.
Thanks, but as edit function disOrEnb ?
I write this, but is not working: -
-
<HTML>
-
<HEAD>
-
-
<script language="javascript">
-
<!--
-
-
-
function ApriPopup(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+'');
-
}
-
-
-
function disOrEnb(sel) {
-
-
document.forms[0].ore.disabled = sel.value == 'Assente' ? true : false;
-
document.getElementById('link').href = sel.value == 'Assente' ? 'javascript:void(0)' : 'javascript:ApriPopup(500,500,\'popup.asp\')';
-
document.getElementById('b1').src = sel.value == 'Assente' == "chiudi_button.gif";
-
}
-
-
-
//-->
-
</script>
-
-
</HEAD>
-
-
<BODY>
-
-
<form method="POST" action="test.asp">
-
-
<select size="1" name="Stato" onchange="disOrEnb(this)">
-
<option>Seleziona</option>
-
<option value="Assente">Assente</option>
-
<option value="Presente">Presente</option>
-
</select>
-
-
<select size="1" name="Stato_g">
-
<option>Seleziona</option>
-
<option value="Ferie">Ferie</option>
-
<option value="Malattia">Malattia</option>
-
<option value="In sede">In sede</option>
-
<option value="Fuori sede">Fuori sede</option>
-
</select>
-
-
-
<input type="text" name="ore" size="20">
-
<a id="link" href="javascript:ApriPoup(500,500,'popup.asp');">
-
-
<img border="0" id="b1" src="invia_button.gif"></a>
-
-
</form>
-
-
</BODY>
-
</HTML>
-
hsriat 1,654
Recognized Expert Top Contributor
This is not the right syntax, use this: - document.getElementById('b1').src = sel.value == 'Assente' ? 'button1.gif' : 'button2.gif';
This syntax should be in the form:
var a = condition ? b : c;
This means if condition is true, a = b, else a = c
Got it?
Many thanks...
Regards,
Viki1967
Sign in to post your reply or Sign up for a free account.
Similar topics
by: HolaGoogle |
last post by:
Hi all,
Can you please tell me what's wrong with my code??? i do have this
database in wich i have to field.One is a "yes/no" field and another
one is "number" field. To display the yes/no field...
|
by: HolaGoogle |
last post by:
Can you please tell me the right way to do this?? it's realy
important! thanks in advance...
Hi all,
Can you please tell me what's wrong with my code??? i do have this
database in wich i have...
|
by: Forti2ude |
last post by:
Hello,
I have a simple form...
<form>
<select name="foo" multiple>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>
|
by: techfuzz |
last post by:
I scoured this group and others looking for the best way to disable a
button after the first click to prevent multiple submissions, but
never did find anything that worked like they said it would. ...
|
by: kschneider |
last post by:
Assume there's a form with it's action attribute all set to post to a
URL, but without a submit control. Form submission is done via a link
and I want to prevent the classic "double submit"....
|
by: Mike |
last post by:
I have a form that contains 240 "products". Each Product has a TR. Each TR
contains a Yes and No radio button and a Product-Qty text input.
A situation exists where I have to go through all the...
|
by: surf_doggie |
last post by:
Im not sure if this is the group to post in, if anyone knows a more
appropriate one please let me know.
Please consider the following example of a feature most all browsers
have that I would...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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: 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: 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...
|
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 ...
| |