• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple Select box Problem

 
Ranch Hand
Posts: 57
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai all,

I am developing an application which uses Jsp, Servlets, Javascript and Html. while developing the application the following problem occurs. i.e

BARCODE NAME COST QUANTITY TOTAL

The above all are select boxes. when we select the barcode the Name of the product of that barcode must be displayed in Name text box . For that I use javascript Onchange function. Which works fine for First row. But After Total I have another script that creates another row of text boxes. Here the actual problem starts. when I select the barcode of Second select box The OnChange function not working .
The entire code written in Jsp.

If any Solution I am very Thankful to You
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you creating the new row? Are you attaching a new onchange handler?

Eric
 
mike mimmis
Ranch Hand
Posts: 57
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes by using onchange event i am creating multiple rows
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe a lil bit piece of code will be helpful.

if it were me, i would use jquery and use each() function.
 
mike mimmis
Ranch Hand
Posts: 57
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok i dont have knowledge of jquery. It has to be in javascript or html or jsp
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still have not showed code...

It is like a doctor performing surgery without the patient.

Eric
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

raj legend wrote:ok i dont have knowledge of jquery. It has to be in javascript or html or jsp


jQuery is JavaScript. And it will help you do a lot of things much more easily. It is highly recommended.
 
mike mimmis
Ranch Hand
Posts: 57
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you send me logic in jqery...
 
mike mimmis
Ranch Hand
Posts: 57
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my code,



<HTML>
<HEAD>
<TITLE> Shopping </TITLE>
<SCRIPT language="javascript">
function addRow(tableID) {

var table = document.getElementById(tableID);

var rowCount = table.rows.length;
var row = table.insertRow(rowCount);

var colCount = table.rows[0].cells.length;

for(var i=0; i<colCount; i++) {

var newcell = row.insertCell(i);

newcell.innerHTML = table.rows[0].cells[i].innerHTML;

switch(newcell.childNodes[0].type) {
case "text":
newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
case "select-one":
newcell.childNodes[0].selectedIndex = 0;
break;
}
}
}

function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;

for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
if(rowCount <= 1) {
alert("Cannot delete all the rows.");
break;
}
table.deleteRow(i);
rowCount--;
i--;
}

}
}catch(e) {
alert(e);
}
}

</SCRIPT>
<script type="text/javascript">
function call()
{
alert("in call()");
var table = document.getElementById(tableID);

var rowCount = table.rows.length;
for(var i=0;i<colCount;i++)
{
var bc=form.brcode[i].value;
alert("value of barcode="+bc[i]);
}

}
</script>
</HEAD>
<BODY>


<form name="form" id="form" action="testExample.jsp">
<TABLE id="dataTable" width="350px" border="1">
<TR>
<TD><INPUT type="checkbox" name="chk"/></TD>
<TD><INPUT type="text" name="brcode" onchange="call();"/></TD>
<TD><INPUT type="text" name="title" /></TD>
<TD><INPUT type="text" name="cost" /></TD>
<TD><INPUT type="text" name="quantity" /></TD>

<TD><INPUT type="text" name="quantity" onchange="addRow('dataTable')" /></TD>
</TR>
</TABLE>
<INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable')"/>
</form>
</BODY>
</HTML>
 
I don't even know how to spell CIA. But this tiny ad does:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic