[Javascript] Checkbox values
Hello.
I have a problem with this code ASP / Javascript.
The problem is JavaScript; try this LINK and select value cespiti
1) With ASP language is populated a secondary form, generated by a main form with a series of checkboxes, text fields and select;
2) Selecting different checkbox from a secondary form and compiled other fields, this values must be copied to a single field hidden in the principal form;
If the checkbox returned by the query SQL, is unique, the string:
is right and compiled values in the field hidden in principal form.
But if the checkbox returned by the query SQL are different, the string:
response with: - undefined;undefined;undefined;undefined
Can you help me?
kind regards
mike
22 2725 acoder 16,027
Recognized Expert Moderator MVP
Can you explain what you mean by "checkbox returned by the query SQL is unique/different"?
Can you explain what you mean by "checkbox returned by the query SQL is unique/different"?
checkbox unique in the secondary form: - <input type="checkbox" name="DETTAGLIO_1" value="CS7">
checkbox different in the secondary form: -
-
<input type="checkbox" name="DETTAGLIO_1" value="CS7">
-
-
<input type="checkbox" name="DETTAGLIO_2" value="CS20">
-
-
<input type="checkbox" name="DETTAGLIO_3" value="NCS24">
-
-
acoder 16,027
Recognized Expert Moderator MVP
How do you generate the LG string?
How do you generate the LG string?
Open this link: http://users1.titanichost.com/MiguelRivero61/
Select "cespiti" value in the main form;
In the popup page I have secondary form;
Select checkbox and the other fields and click in the button "salva".
Generate LG string
I have change the code.
This is main form: -
-
<html>
-
<head>
-
<script language="javascript" type="text/javascript">
-
<!--
-
-
// Variabile globale contenente l'istanza 'window' del popup corrente
-
var popup = null;
-
-
function Forum(fld, tbl, col, w, h)
-
{
-
var pw = Math.floor((screen.width - w) / 2);
-
var ph = Math.floor((screen.height - h) / 2);
-
-
// Crea il popup solo se non è già stato aperto
-
if (!popup || popup.closed) popup = window.open("popup.htm?f=" + fld + "&t=" + tbl + "&c=" + col, "scelte",
-
"width=" + w + ",height=" + h + ",top=" + ph + ",left=" + pw);
-
-
// Attiva il popup (portalo in primo piano)
-
if (popup) popup.focus();
-
}
-
-
//-->
-
</script>
-
-
</head>
-
-
<body>
-
-
<form name=myform action="?upload=1" method="POST">
-
-
<INPUT TYPE="hidden" NAME="dati_aggiuntivi" VALUE="xxxx">
-
-
<select size="1" name="dettaglio_visita" style="font-size: 8 pt; font-family: Verdana" onchange="Forum(this.value, 'tbl_mac_visite_ispettive_dett', 'DETTAGLIO_VERIFICA', 700, 500); this.selectedIndex = 0;">">
-
-
<option>Seleziona</option>
-
<option value="14-Cespiti">Cespiti</option>
-
</select>
-
-
</form>
-
-
</body>
-
</html>
-
-
This is secondary form: acoder 16,027
Recognized Expert Moderator MVP
The problem is line 286: - <a href="javascript:insertf1(document.myform.SOTTODETTAGLIO _VERIFICA_6.value+';'+document.myform.Esito.value+ ';'+document.myform.ITEMS_6.value+';'+document.myf orm.ITEMS_KO_6.value)">
What do you actually want to happen? For example, if I select checkbox 1, do you want anything to appear, or do you always want to pass the last row data?
The problem is line 286: - <a href="javascript:insertf1(document.myform.SOTTODETTAGLIO _VERIFICA_6.value+';'+document.myform.Esito.value+ ';'+document.myform.ITEMS_6.value+';'+document.myf orm.ITEMS_KO_6.value)">
What do you actually want to happen? For example, if I select checkbox 1, do you want anything to appear, or do you always want to pass the last row data?
Ok I understand.
I need insert in the string: - <a href="javascript:insertf1(document.myform.SOTTODETTAGLIO _VERIFICA_6.value+';'+document.myform.Esito.value+ ';'+document.myform.ITEMS_6.value+';'+document.myf orm.ITEMS_KO_6.value)">
all the values selected in the secondary form and insert this string in the hidden field of the main form; whether a value or more values.
acoder 16,027
Recognized Expert Moderator MVP
Is there a particular reason why the elements are named differently? You can use the same name, just not the same ID. If you have the same name, you can use document.getEle mentsByName() to get a list/array of elements which you can loop over. Check the checked property of the checkboxes to see if that row is one of the selected ones to pass the values through.
Is there a particular reason why the elements are named differently? You can use the same name, just not the same ID. If you have the same name, you can use document.getEle mentsByName() to get a list/array of elements which you can loop over. Check the checked property of the checkboxes to see if that row is one of the selected ones to pass the values through.
Ok, I try this but response with error 'Object required', why?: -
-
function insertf1(stringa)
-
-
{
-
-
var s = "";
-
for( var i = 0; i < 7; i++)
-
-
{
-
-
s += "," + document.getElementById('test_'+i).value;
-
-
}
-
window.opener.document.myform.dati_aggiuntivi.value=s;
-
-
return s.substr();
-
-
}
-
-
<select size="1" id=test_1" name="test_1">
-
...
-
</select>
-
-
<select size="1" id=test_2" name="test_2">
-
...
-
</select>
-
-
<select size="1" id=test_3" name="test_3">
-
...
-
</select>
-
-
<input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_1" value="NCS43">
-
-
<input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_2" value="NCS44">
-
-
<input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_3" value="NCS28">
-
-
<a href="#" onclick="insertf1();return false;">
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: den 2005 |
last post by:
Hi everybody,
Question 1: How do you set the values from server-side to a client-side
control or how do you execute a javascript function without a button click
event?
Question 2: How do you get response from a Confirm() popup window to
uncheck all server-side checkboxes placed in a panle of a web user control?
I am using ASP.Net 2.0, ...
|
by: Oleg Konovalov |
last post by:
Hi,
I am working on a web application which among other things uses DHTML, Java
and Javascript.
It populates web page based on the contents of the database (resultset),
and next to each row there is a checkbox (v1) allowing to select that row
for changes (e.g. delete, update, etc.)
So we are creating an array of checkbox, correct ?
Of...
|
by: anthonybrough |
last post by:
I have an asp page that has a form to collect user data in a form.
when the user clicks submit the input is validated. If any fields are
not acceptable the user clicks on a button to go back to the original
form to correct the input. This all works fine until I try to
incorporate a javascript to display a popup calendar which posts the...
|
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...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
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...
|
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...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |