473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

auto populate

smiley22
javascript.

i had a code like this, which add a rows in a table, with an inputtext and a button in each row. i want to know how will i do this scenario:

that when i add 5 'tdOrdersSerial' and 5 'tdOrdersMobile', when i clicked button added in each 'tdOrdersMobile' the value in the input text will auto populate in the 'tdOrdersSerial' (index 0 to index5, index 2 - index 6, etc.). and when i add another 5 'tdOrdersSerial' and 5 'tdOrdersMobile' the values in the first batch will not be removed,.

please help,. im stucked for a long time. :(

Thanks and regards

Expand|Select|Wrap|Line Numbers
  1. tdElementSet1 = document.createElement('td');
  2. tdElementSet1.id = 'tdOrdersSerial';
  3. tdElementSet1.innerHTML = '&nbsp;' + varSerialNo + '<input type="hidden" name="hdnOrdersSerialNo" value="' + varSerialNo + '">';
  4. + '<input type="button" name="btnItemDetail" id="btnItemDetail"  onClick="getSerializedHandsetLOV()>'
  5. trElementSet1.appendChild(tdElementSet1);
  6.  
  7. tdElementSet1 = document.createElement('td');
  8. tdElementSet1.id = 'tdOrdersMobile';
  9. tdElementSet1.innerHTML = '&nbsp;' + varMobileNo + '<input type="hidden" name="hdnOrdersMobileNo" value="' + varMobileNo + '">';
  10.  + '<input type="button" name="btnItemDetails" id="btnItemDetails"  onClick="getSerializedSimLOV()>'
Oct 10 '07 #1
42 2486
dmjpro
2,476 2GB
javascript.

i had a code like this, which add a rows in a table, with an inputtext and a button in each row. i want to know how will i do this scenario:

that when i add 5 'tdOrdersSerial' and 5 'tdOrdersMobile', when i clicked button added in each 'tdOrdersMobile' the value in the input text will auto populate in the 'tdOrdersSerial' (index 0 to index5, index 2 - index 6, etc.). and when i add another 5 'tdOrdersSerial' and 5 'tdOrdersMobile' the values in the first batch will not be removed,.

please help,. im stucked for a long time. :(

Thanks and regards

Expand|Select|Wrap|Line Numbers
  1. tdElementSet1 = document.createElement('td');
  2. tdElementSet1.id = 'tdOrdersSerial';
  3. tdElementSet1.innerHTML = '&nbsp;' + varSerialNo + '<input type="hidden" name="hdnOrdersSerialNo" value="' + varSerialNo + '">';
  4. + '<input type="button" name="btnItemDetail" id="btnItemDetail"  onClick="getSerializedHandsetLOV()>'
  5. trElementSet1.appendChild(tdElementSet1);
  6.  
  7. tdElementSet1 = document.createElement('td');
  8. tdElementSet1.id = 'tdOrdersMobile';
  9. tdElementSet1.innerHTML = '&nbsp;' + varMobileNo + '<input type="hidden" name="hdnOrdersMobileNo" value="' + varMobileNo + '">';
  10.  + '<input type="button" name="btnItemDetails" id="btnItemDetails"  onClick="getSerializedSimLOV()>'
Now what error you are getting ?

Debasis Jana
Oct 10 '07 #2
Now what error you are getting ?

Debasis Jana

i had no idea how to implement it. :(
Oct 10 '07 #3
dmjpro
2,476 2GB
i had no idea how to implement it. :(
Please Clarify me here.
"(index 0 to index5, index 2 - index 6, etc.)"
What does that mean?

Debasis Jana
Oct 10 '07 #4
Now what error you are getting ?

Debasis Jana

i had no idea how to implement it. :(
Oct 10 '07 #5
dmjpro
2,476 2GB
i had no idea how to implement it. :(
You already had your Code ...
What is this .... "i had no idea how to implement it"?
And please tell me the "Indexing System"

Debasis Jana.
Oct 10 '07 #6
i had no idea how to implement it. :(
ex.

tdOrdersSerial [0]
tdOrdersSerial [1]
tdOrdersSerial [2]

tdOrdersMobile [3]
tdOrdersMobile [4]
tdOrdersMobile [5]

when button on 5 is clicked, the value will be on 2
when 4, value will be in 2
Oct 10 '07 #7
dmjpro
2,476 2GB
javascript.

i had a code like this, which add a rows in a table, with an inputtext and a button in each row. i want to know how will i do this scenario:

that when i add 5 'tdOrdersSerial' and 5 'tdOrdersMobile', when i clicked button added in each 'tdOrdersMobile' the value in the input text will auto populate in the 'tdOrdersSerial' (index 0 to index5, index 2 - index 6, etc.). and when i add another 5 'tdOrdersSerial' and 5 'tdOrdersMobile' the values in the first batch will not be removed,.

please help,. im stucked for a long time. :(

Thanks and regards

Expand|Select|Wrap|Line Numbers
  1. tdElementSet1 = document.createElement('td');
  2. tdElementSet1.id = 'tdOrdersSerial';
  3. tdElementSet1.innerHTML = '&nbsp;' + varSerialNo + '<input type="hidden" name="hdnOrdersSerialNo" value="' + varSerialNo + '">';
  4. + '<input type="button" name="btnItemDetail" id="btnItemDetail"  onClick="getSerializedHandsetLOV()>'
  5. trElementSet1.appendChild(tdElementSet1);
  6.  
  7. tdElementSet1 = document.createElement('td');
  8. tdElementSet1.id = 'tdOrdersMobile';
  9. tdElementSet1.innerHTML = '&nbsp;' + varMobileNo + '<input type="hidden" name="hdnOrdersMobileNo" value="' + varMobileNo + '">';
  10.  + '<input type="button" name="btnItemDetails" id="btnItemDetails"  onClick="getSerializedSimLOV()>'

"when 4, value will be in 2" it will be most probably ...... "when 4, value will be in 1"
So you need the code of "getSerializedSimLOV()" function.
One more thing "Smiley22", that is try to have unique "ID".
So you have some rows of "Serial Number" and "Mobial Number".
Now you want these corresponding two values when a button clicked.
Right?
Assuming this I am trying to implement your Code.

Expand|Select|Wrap|Line Numbers
  1. <input type="button" name="btnItemDetails" id="btnItemDetails"  onClick="getSerializedSimLOV(this)>
  2.  
Expand|Select|Wrap|Line Numbers
  1. function getSerializedSimLOV(obj)
  2. {
  3.  var row = obj.parentNode.parentNode.rowIndex;
  4.  var serials = document.getElementsByNames("hdnOrdersSerialNo");
  5.  var mobiles = document.getElementsByNames("hdnOrdersMobileNo");
  6.  alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
  7. }
  8.  
Have a try with this.
Good Luck !

Debasis Jana
Oct 10 '07 #8
"when 4, value will be in 2" it will be most probably ...... "when 4, value will be in 1"
So you need the code of "getSerializedSimLOV()" function.
One more thing "Smiley22", that is try to have unique "ID".
So you have some rows of "Serial Number" and "Mobial Number".
Now you want these corresponding two values when a button clicked.
Right?
Assuming this I am trying to implement your Code.

Expand|Select|Wrap|Line Numbers
  1. <input type="button" name="btnItemDetails" id="btnItemDetails"  onClick="getSerializedSimLOV(this)>
  2.  
Expand|Select|Wrap|Line Numbers
  1. function getSerializedSimLOV(obj)
  2. {
  3.  var row = obj.parentNode.parentNode.rowIndex;
  4.  var serials = document.getElementsByNames("hdnOrdersSerialNo");
  5.  var mobiles = document.getElementsByNames("hdnOrdersMobileNo");
  6.  alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
  7. }
  8.  
Have a try with this.
Good Luck !

Debasis Jana

yeah, when 4 its 1, oh im wrong again. sorry ok i'll try this..

thanks :)
Oct 10 '07 #9
yeah, when 4 its 1, oh im wrong again. sorry ok i'll try this..

thanks :)
im getting an error here:

var serials = document.crmForm.getElementsByNames("hdnOrdersSeri alNo");

var mobiles = document.crmForm.getElementsByNames("hdnOrdersMobi leNo");

alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);


object doesn't support this property or method :(
Oct 10 '07 #10
dmjpro
2,476 2GB
im getting an error here:

var serials = document.crmForm.getElementsByNames("hdnOrdersSeri alNo");

var mobiles = document.crmForm.getElementsByNames("hdnOrdersMobi leNo");

alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);


object doesn't support this property or method :(
Did you check my Code?
"document.crmForm" who told you to add "crmForm" with "document"?
It will be only "document.get....".

Debasis Jana.
Oct 10 '07 #11
Did you check my Code?
"document.crmForm" who told you to add "crmForm" with "document"?
It will be only "document.get....".

Debasis Jana.
ah yeah, i also used that code without crmForm.. but the error was the same.
Oct 10 '07 #12
dmjpro
2,476 2GB
ah yeah, i also used that code without crmForm.. but the error was the same.
Oho.........Sorry !
It will be "..ByName" instead of "..ByNames".
Got me.
Do it ... and let me know.

Debasis Jana
Oct 10 '07 #13
Oho.........Sorry !
It will be "..ByName" instead of "..ByNames".
Got me.
Do it ... and let me know.

Debasis Jana
the error was resolve,

but the alert serial and mobile was undefined..
Oct 10 '07 #14
dmjpro
2,476 2GB
the error was resolve,

but the alert serial and mobile was undefined..
Alert the varibale "row";
See what outputs it.
And make sure that it returns proper Row Index.
And check out the generated HTML code, how much HTML elements by name "hdnOrdersSerialNo" and "hdnOrdersMobileNo".

Then tell me all these things.

Debasis Jana
Oct 10 '07 #15
Alert the varibale "row";
See what outputs it.
And make sure that it returns proper Row Index.
And check out the generated HTML code, how much HTML elements by name "hdnOrdersSerialNo" and "hdnOrdersMobileNo".

Then tell me all these things.

Debasis Jana
i only get 0(zero) rows.......
Oct 10 '07 #16
dmjpro
2,476 2GB
i only get 0(zero) rows.......
ok....Now send me the generated HTML code.
And also JavaScript Code.

Debasis Jana
Oct 10 '07 #17
ok....Now send me the generated HTML code.
And also JavaScript Code.

Debasis Jana

but its too long ;( how will i send i only send a little part of it, because i want to get idea from you guys, coz i really not familiar with that code
Oct 10 '07 #18
but its too long ;( how will i send i only send a little part of it, because i want to get idea from you guys, coz i really not familiar with that code

function getSerializedSimLOV1(obj)
{

var row = obj.parentNode.parentNode.rowIndex;

var serials = document.getElementsByName("hdnOrdersSerialNo");

var mobiles = document.getElementsByName("hdnOrdersMobileNo");

alert('row' + row);

alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
}
Oct 10 '07 #19
dmjpro
2,476 2GB
but its too long ;( how will i send i only send a little part of it, because i want to get idea from you guys, coz i really not familiar with that code
Part by Part send me ......

Debasis Jana
Oct 10 '07 #20
Part by Part send me ......

Debasis Jana
this is the code that generate the rows of the table when the add button is clicked,
the tdOrdersSerialNo and tdOrdersMobileNO contains the button and inputext


Expand|Select|Wrap|Line Numbers
  1.                                 tdElementSet = document.createElement('td');
  2.                                 tblElementSet1 = document.createElement('table');
  3.                                 tbodyElementSet1 = document.createElement('tbody');
  4.                                 trElementSet1 = document.createElement('tr');
  5.  
  6.                                 tdElementSet.width = '740';
  7.  
  8.                                 tblElementSet1.id = varSetTbl2ID + varGlobalRowCounter;
  9.                                 tblElementSet1.width = '740';
  10.                                 tblElementSet1.className = 'tableList2';
  11.                                 tblElementSet1.border = '0';
  12.                                 tblElementSet1.cellPadding = '0';
  13.                                 tblElementSet1.cellSpacing = '1';
  14.                                 //tblElementSet1.setAttribute('cellpadding', '0'); 
  15.                                 //tblElementSet1.setAttribute('cellspacing', '1'); 
  16.  
  17.                                 tbodyElementSet1.id = varSetTbody2ID + varGlobalRowCounter;
  18.  
  19.                                 varGlobalRowCounterString = varGlobalRowCounter;
  20.                                 varGlobalRowCount = 1;
  21.  
  22.  
  23.                                 tdElementSet1 = document.createElement('td');
  24.                                 tdElementSet1.id = 'tdOrdersCheckbox';
  25.                                 //tdElementSet1.bgcolor = '#ffffff';
  26.                                 tdElementSet1.valign = 'center';
  27.                                 tdElementSet1.align = 'center';
  28.                                 tdElementSet1.width = '23';
  29.                                 //tdElementSet1.height = '24';
  30.                                 tdElementSet1.className = 'tableList2';
  31.                                 tdElementSet1.innerHTML = '<input type="checkbox" name="checkbox" value="">'
  32.                                         + '<input type="hidden" name="hdnOrdersItemSetFlag" value="' + varItemSetFlag + '">'
  33.                                         + '<input type="hidden" name="hdnOrdersGlobalRowCounter" value="' + varGlobalRowCounterString + '">'
  34.                                         + '<input type="hidden" name="hdnOrdersGlobalRowCount" value="' + varGlobalRowCount + '">'
  35.                                         + '<input type="hidden" name="hdnOrdersDocOwnerCode" value="' + varDocOwnerCode + '">'
  36.                                         + '<input type="hidden" name="hdnOrdersBundledCode" value="' + varBundledCode + '">'
  37.                                         + '<input type="hidden" name="hdnOrdersAllowNegativeFlag" value="' + varAllowNegativeFlag + '">'
  38.                                         + '<input type="hidden" name="hdnOrdersMainCategoryCode" value="' + varMainCategoryCode + '">'
  39.                                         + '<input type="hidden" name="hdnOrdersSIMFlag" value="' + varSIMFlag + '">'
  40.                                         + '<input type="hidden" name="hdnOrdersBundlingCounter" value="' + varBundlingCounter + '">'
  41.                                         + '<input type="hidden" name="hdnOrdersBundlingRemovalFlag" value="' + varBundlingRemovalFlag + '">';
Expand|Select|Wrap|Line Numbers
  1. trElementSet1.appendChild(tdElementSet1);
  2.  
  3.                                 tdElementSet1 = document.createElement('td');
  4.                                 tdElementSet1.id = 'tdOrdersItemCode';
  5.                                 //tdElementSet1.bgcolor = '#ffffff';
  6.                                 tdElementSet1.valign = 'bottom';
  7.                                 tdElementSet1.align = 'left';
  8.                                 tdElementSet1.width = '84';
  9.                                 //tdElementSet1.height = '24';
  10.                                 tdElementSet1.className = 'tableList2';
  11.                                 tdElementSet1.innerHTML = '&nbsp;' + varItemCode + '<input type="hidden" name="hdnOrdersItemCode" id="hdnOrdersItemCode' + (varGlobalRowCounter + 1) + '" value="' + varItemCode + '">';
  12.                                 //tdElementSet1.innerHTML = '&nbsp;' + varPlanCode + '<input type="hidden" name="hdnOrdersPlanCode" id="hdnOrdersPlanCode' + (varGlobalRowCounter + 1) + '" value="' + varPlanCode + '">'
  13.  
  14.                                 trElementSet1.appendChild(tdElementSet1);
  15.  
  16.                                 tdElementSet1 = document.createElement('td');
  17.                                 tdElementSet1.id = 'tdOrdersItemDesc';
  18.                                 //tdElementSet1.bgcolor = '#ffffff';
  19.                                 tdElementSet1.valign = 'bottom';
  20.                                 tdElementSet1.align = 'left';
  21.                                 tdElementSet1.width = '128';
  22.                                 //tdElementSet1.height = '24';
  23.                                 tdElementSet1.className = 'tableList2';
  24.  
  25.  
  26.                                 tdElementSet1.innerHTML = '&nbsp;' + varItemDesc + '<input type="hidden" name="hdnOrdersItemDesc" value="' + varItemDesc + '">'
  27.                                         + '<input type="hidden" name="hdnOrdersItemTypeCode" value="' + varItemTypeCode + '">'                                
  28.                                         + '<input type="hidden" name="hdnOrdersItemSetHeaderID" value="' + varItemSetHeaderID + '">'
  29.                                         + '<input type="hidden" name="hdnOrdersGlobalRowIndex" value="' + varGlobalRowCounter + '">'                                                                
  30.                                         + '<input type="hidden" name="hdnOrdersSubSLOCCode" id="hdnOrdersSubSLOCCode' + (varGlobalRowCounter + 1) + '"value="' + varSubSLOCCode + '">'
  31.                                         + '<input type="hidden" name="hdnOrdersEntCode" value="' + varEntCode + '">'
  32.                                         + '<input type="hidden" name="hdnOrdersEntAmt" value="' + varEntAmt + '">'
  33.                                         + '<input type="hidden" name="hdnOrdersPriceTypeCode" value="' + varPriceTypeCode + '">'
  34.                                         + '<input type="hidden" name="hdnDummyFlag" value="' + varDummyFlag + '">';
Expand|Select|Wrap|Line Numbers
  1. trElementSet1.appendChild(tdElementSet1);
  2.                                 tdElementSet1 = document.createElement('td');
  3.                                 tdElementSet1.id = 'tdOrdersSerialNo';
  4.                                 //tdElementSet1.bgcolor = '#ffffff';
  5.                                 tdElementSet1.valign = 'bottom';
  6.                                 tdElementSet1.align = 'left';
  7.                                 tdElementSet1.width = '123';
  8.                                 //tdElementSet1.height = '24';
  9.                                 tdElementSet1.className = 'tableList2';
  10.  
  11.                                 /*if ( varMainCategoryCode == "SIM")  {
  12.                                     tdElementSet1.innerHTML = '<input type="button" class="inputButton" name="btnItemDetails" id="btnItemDetails" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSerializedSimLOV(' + (varGlobalRowCounter + 1) + ')">';
  13.                                 }    
  14.                                 else if (varMainCategoryCode =="HANDSET")
  15.                                     tdElementSet1.innerHTML = '<input type="button" class="inputButton" name="btnItemDetails" id="btnItemDetails" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSerializedHandsetLOV(' + (varGlobalRowCounter + 1) + ')">';
  16.                                     */                    
  17.                                 if (varMainSlocReqSerial == "1") {    
  18.                                     //serial
  19.                                     if ((varAttriIMEI == 0  && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmForm.chkDummy.checked == true))
  20.                                         tdElementSet1.innerHTML = '&nbsp;' + '<input type="hidden"  size="16" class="mandatory" align ="center" maxlength="16" name="hdnSerialNo" value="' + varSerialNo + '">';
  21.                                     else {
  22.                                          if ( varMainCategoryCode == "HANDSET")  {
  23.                                             tdElementSet1.innerHTML = '&nbsp;' + '<input type="text"  size="16" class="mandatory" align ="center" maxlength="16" name="hdnSerialNo" value="' + varSerialNo + '">'
  24.                                                                + '&nbsp;' + '<input type="button" class="inputButton" name="btnItemDetails" id="btnItemDetails" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSerializedHandsetLOV(' + (varGlobalRowCounter + 1) + ')">'
  25.                                                                + '<input type="hidden" class="hidden" name="hdnglobal" id="hdnglobal" value="' + (varGlobalRowCounter + 1) + '">';
  26.  
  27.                                             }    
  28.  
  29.                                           else  if ( varMainCategoryCode == "SIM") {
  30.                                             tdElementSet1.innerHTML = '&nbsp;' + '<input type="text"  size="16" class="mandatory" align ="center" maxlength="16" name="hdnSerialNo" value="' + varSerialNo + '">'
  31.                                                                + '&nbsp;' + '<input type="button" class="inputButton" name="btnItemDetails" id="btnItemDetails" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSerializedSimLOV(' + (varGlobalRowCounter + 1) + ');getSerializedSimLOV1">'
  32.                                                                + '<input type="hidden" class="hidden" name="hdnglobal" id="hdnglobal" value="' + (varGlobalRowCounter + 1) + '">';
  33.                                          }                       
  34.                                     }    
  35.                                 }  
  36.                                 else {
  37.                                     if ((varAttriIMEI == 0  && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmForm.chkDummy.checked == true)) 
  38.                                         tdElementSet1.innerHTML = '&nbsp;' + '<input type="hidden"  size="16" class="mandatory" align ="center" maxlength="16" name="hdnSerialNo" value="' + varSerialNo + '">';
  39.                                     else
  40.  
  41.                                     tdElementSet1.innerHTML = '&nbsp;' + '<input type="text"  size="16" class="mandatory" align ="center" maxlength="16" name="hdnSerialNo" value="' + varSerialNo + '">'
  42.                                 }
Expand|Select|Wrap|Line Numbers
  1. trElementSet1.appendChild(tdElementSet1);
  2.                                 tdElementSet1 = document.createElement('td');
  3.                                 tdElementSet1.id = 'tdOrdersMobileNo';
  4.                                 //tdElementSet1.bgcolor = '#ffffff';
  5.                                 tdElementSet1.valign = 'bottom';
  6.                                 tdElementSet1.align = 'left';
  7.                                 tdElementSet1.width = '120';
  8.                                 //tdElementSet1.height = '24';
  9.                                 tdElementSet1.className = 'tableList2';
  10.  
  11.                                 if (varMainSlocReqSerial == "1") {    
  12.  
  13.                                     if ((varAttriIMEI == 0  && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmForm.chkDummy.checked == true))
  14.                                         tdElementSet1.innerHTML = '&nbsp;' + '<input type="hidden" size="14" name="hdnMIN" align="center" maxlength="10" class="mandatory" value="' + varMIN + '">';
  15.                                     else  { 
  16.                                          if ( varMainCategoryCode == "SIM" )  {
  17.  
  18.                                             tdElementSet1.innerHTML = '&nbsp;' + '<input type="text"  size="16" class="mandatory" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">'
  19.                                                                + '&nbsp;' + '<input type="button" class="inputButton" name="btnItemDetails" id="btnItemDetails" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSerializedSimLOV(' + (varGlobalRowCounter + 1) + ')">';
  20.                                             }
  21.                                          else if (( varMainCategoryCode == "HANDSET")  && (document.getElementById("nc").checked == true))  {
  22.                                             tdElementSet1.innerHTML = '&nbsp;' + '<input type="text"  size="16" class="mandatory" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">'
  23.                                                            + '&nbsp;' + '<input type="button" class="inputButton" name="btnItemDetails" id="btnItemDetails" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSerializedMinLOV(' + (varGlobalRowCounter + 1) + ')">';
  24.                                          } else if (document.getElementById("rn").checked == true) {
  25.                                             tdElementSet1.innerHTML = '&nbsp;' + '<input type="text"  size="16" class="mandatory" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">';
  26.                                         }
  27.                                     }
  28.                                 }        
  29.                                 else {
  30.                                     if ((varAttriIMEI == 0  && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmForm.chkDummy.checked == true))
  31.                                         tdElementSet1.innerHTML = '&nbsp;' + '<input type="hidden" size="14" name="hdnMIN" align="center" maxlength="10" class="mandatory" value="' + varMIN + '">';
  32.                                     else
  33.                                         tdElementSet1.innerHTML = '&nbsp;' + '<input type="text"  size="16" class="mandatory" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">';
  34.  
  35.                                 }
  36.  
  37.                                 trElementSet1.appendChild(tdElementSet1);
  38.                                 tdElementSet1 = document.createElement('td');
  39.                                 tdElementSet1.id = 'tdOrdersTranTypeCode';
  40.                                 //tdElementSet1.bgcolor = '#ffffff';
  41.                                 tdElementSet1.valign = 'bottom';
  42.                                 tdElementSet1.align = 'left';
  43.                                 tdElementSet1.width = '70';
  44.                                 //tdElementSet1.height = '24';
  45.                                 tdElementSet1.className = 'tableList2';
  46.                                 tdElementSet1.innerHTML = '&nbsp;' + varTranTypeCode + '<input type="hidden" name="hdnOrdersTranTypeCode" value="' + varTranTypeCode + '">';
  47.                                 trElementSet1.appendChild(tdElementSet1);
  48.  
  49.                                 tdElementSet1 = document.createElement('td');
  50.                                 tdElementSet1.id = 'tdOrdersPlanCode';
  51.                                 //tdElementSet1.bgcolor = '#ffffff';
  52.                                 tdElementSet1.valign = 'bottom';
  53.                                 tdElementSet1.align = 'left';        
  54.                                 tdElementSet1.width = '68';
  55.                                 //tdElementSet1.height = '24';
  56.                                 tdElementSet1.className = 'tableList2';
  57.                                 tdElementSet1.innerHTML = '&nbsp;' + varPlanCode + '<input type="hidden" name="hdnOrdersPlanCode" value="' + varPlanCode + '">'
  58.                                         + '<input type="hidden" name="hdnOrdersPlanAmt" value="' + varPlanAmt + '">';
  59.                                 trElementSet1.appendChild(tdElementSet1);
  60.  
  61.                                 tdElementSet1 = document.createElement('td');
  62.                                 tdElementSet1.id = 'tdOrdersQuantity';
  63.                                 //tdElementSet1.bgcolor = '#ffffff';
  64.                                 tdElementSet1.valign = 'bottom';
  65.                                 tdElementSet1.align = 'right';
  66.                                 tdElementSet1.width = '40';
  67.                                 //tdElementSet1.height = '24';
  68.                                 tdElementSet1.className = 'tableList2';
  69.                                 tdElementSet1.innerHTML = '&nbsp;' + varFormattedQuantity + '<input type="hidden" name="hdnOrdersQuantity" value="' + varQuantity + '">';
  70.                                 trElementSet1.appendChild(tdElementSet1);
  71.  
  72.                                 tdElementSet1 = document.createElement('td');
  73.                                 tdElementSet1.id = 'tdOrdersItemTotalAmt';
  74.                                 //tdElementSet1.bgcolor = '#ffffff';
  75.                                 tdElementSet1.valign = 'bottom';
  76.                                 tdElementSet1.align = 'right';
  77.                                 tdElementSet1.width = '84';
  78.                                 //tdElementSet1.height = '24';
  79.                                 tdElementSet1.className = 'tableList2';
  80.                                 tdElementSet1.innerHTML = '&nbsp;' + varItemTotalAmt + '<input type="hidden" name="hdnOrdersItemTotalAmt" value="' + varItemTotalAmt + '">'
  81.                                         + '<input type="hidden" name="hdnOrdersItemAmt" value="' + varItemAmt + '">'
  82.                                         + '<input type="hidden" name="hdnOrdersStdItemAmt" value="' + varStdItemAmt + '">'
  83.                                         + '<input type="hidden" name="hdnOrdersDiscount" value="' + varDiscount + '">'
  84.                                         + '<input type="hidden" name="hdnOrdersTotalDiscount" value="' + varOrdersTotalDiscount + '">'
  85.                                         + '<input type="hidden" name="hdnOrdersPricingID" value="' + varPricingID + '">';
  86.                                 trElementSet1.appendChild(tdElementSet1);
  87.  
  88.                                 tdElementSet1 = document.createElement('td');
  89.                                 tdElementSet1.id = 'tdOrdersItemDetails';
  90.                                 //tdElementSet1.bgcolor = '#ffffff';
  91.                                 tdElementSet1.valign = 'center';
  92.                                 tdElementSet1.align = 'center';
  93.                                 tdElementSet1.width = '23';
  94.                                 //tdElementSet1.height = '24';
  95.                                 tdElementSet1.className = 'tableList2';
Expand|Select|Wrap|Line Numbers
  1. trElementSet1.appendChild(tdElementSet1);
  2.                                 tbodyElementSet1.appendChild(trElementSet1);
  3.                                 tblElementSet1.appendChild(tbodyElementSet1);
  4.                                 tdElementSet.appendChild(tblElementSet1);
  5.                                 trElement.appendChild(tdElementSet);
  6.                                 tableBody.appendChild(trElement);
  7.                                 varGlobalRowCounter++;
  8.                                 /*
  9.                                 if ((varBundledCode == null) || (varBundledCode == "null") || (varBundledCode.length == 0)) {
  10.                                     varGlobalBundlingCounter++;
  11.                                 }
  12.                                 */
  13.                                 document.crmForm.chkDummy.checked = false;
  14.                                 varSuccessfulAddRow = true;
  15.                                 //}
  16.                                 }
  17.  
  18.  
  19.  
  20.                                 javascript:
  21.  
  22.                                 function getSerializedSimLOV1(obj)
  23.                                 {
  24.  
  25.                                      var row = obj.parentNode.parentNode.rowIndex;
  26.  
  27.                                      var serials = document.getElementsByName("hdnOrdersSerialNo");
  28.  
  29.                                      var mobiles = document.getElementsByName("hdnOrdersMobileNo");
  30.  
  31.                                      alert('row' + row);
  32.  
  33.                                      alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
  34.                                 }
Oct 11 '07 #21
dmjpro
2,476 2GB
Sorry "Smilly" it's tough to analyze your Code.
Let me know one thing, are you inserting a table inside a table "TD"?
And what is this "varGlobalRowCounter" ?

Debasis Jana
Oct 11 '07 #22
Sorry "Smilly" it's tough to analyze your Code.
Let me know one thing, are you inserting a table inside a table "TD"?
And what is this "varGlobalRowCounter" ?

Debasis Jana

:(

the code inserts a row in a table together with its column..
varGlobalCounter??i used it in other functionality of my program
Oct 11 '07 #23
dmjpro
2,476 2GB
"when 4, value will be in 2" it will be most probably ...... "when 4, value will be in 1"
So you need the code of "getSerializedSimLOV()" function.
One more thing "Smiley22", that is try to have unique "ID".
So you have some rows of "Serial Number" and "Mobial Number".
Now you want these corresponding two values when a button clicked.
Right?
Assuming this I am trying to implement your Code.

Expand|Select|Wrap|Line Numbers
  1. <input type="button" name="btnItemDetails" id="btnItemDetails"  onClick="getSerializedSimLOV(this)>
  2.  
Expand|Select|Wrap|Line Numbers
  1. function getSerializedSimLOV(obj)
  2. {
  3.  var row = obj.parentNode.parentNode.rowIndex;
  4.  var serials = document.getElementsByNames("hdnOrdersSerialNo");
  5.  var mobiles = document.getElementsByNames("hdnOrdersMobileNo");
  6.  alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
  7. }
  8.  
Have a try with this.
Good Luck !

Debasis Jana
Hey I got that.
Expand|Select|Wrap|Line Numbers
  1. alert("Serial: " + serials[row] + "\t" + "Mobile: " + mobiles[row]);
  2.  
Make this changes, you will get the result.

Debasis Jana
Oct 11 '07 #24
Hey I got that.
Expand|Select|Wrap|Line Numbers
  1. alert("Serial: " + serials[row] + "\t" + "Mobile: " + mobiles[row]);
  2.  
Make this changes, you will get the result.

Debasis Jana

its alerts as an object.. serials[object], mobiles[object]
Oct 11 '07 #25
dmjpro
2,476 2GB
its alerts as an object.. serials[object], mobiles[object]
Then simply access it's attributes ........... buddy :)
Actually you are getting perfect object, what you need for then access their properties using "." operator.

Debasis Jana
Oct 11 '07 #26
Then simply access it's attributes ........... buddy :)
Actually you are getting perfect object, what you need for then access their properties using "." operator.

Debasis Jana
aaaahhh, ok, still not clear what to do
Oct 11 '07 #27
dmjpro
2,476 2GB
aaaahhh, ok, still not clear what to do
Ok.............Now you tell me, what do you want from that function.
Actually what is the job to be done by that function.
Tell me carefully.

Debasis Jana
Oct 11 '07 #28
Ok.............Now you tell me, what do you want from that function.
Actually what is the job to be done by that function.
Tell me carefully.

Debasis Jana

the function should married the mobile nos.

ex. when you add 5 handset and 5 sim, each has a mobile no.
the control is in the sims button when you clicked the 6th row which is the first sim there is a value that is retrived by one of my function, then after that, the value should be auto populate in the mobile of the first handset..and then the 7th row which is the second sim in the table..should auto populate the mobile to the second handset etc...

its like they are being married by the mobile no., so sceneario can be
1st marrying - 5 handset, 5 sim
2nd marrying(can be possible) 4 handset, 4 sim
the function should know how to pair the entry in the table..
Oct 11 '07 #29
the function should married the mobile nos.

ex. when you add 5 handset and 5 sim, each has a mobile no.
the control is in the sims button when you clicked the 6th row which is the first sim there is a value that is retrived by one of my function, then after that, the value should be auto populate in the mobile of the first handset..and then the 7th row which is the second sim in the table..should auto populate the mobile to the second handset etc...

its like they are being married by the mobile no., so sceneario can be
1st marrying - 5 handset, 5 sim
2nd marrying(can be possible) 4 handset, 4 sim
the function should know how to pair the entry in the table..
---
i had a variable that determines that the item added to table is either a handset or sim its the - hdnOrdersMainCategoryCode

im confused how to group the items and paired them their corresponding min.
Oct 11 '07 #30
dmjpro
2,476 2GB
the function should married the mobile nos.

ex. when you add 5 handset and 5 sim, each has a mobile no.
the control is in the sims button when you clicked the 6th row which is the first sim there is a value that is retrived by one of my function, then after that, the value should be auto populate in the mobile of the first handset..and then the 7th row which is the second sim in the table..should auto populate the mobile to the second handset etc...

its like they are being married by the mobile no., so sceneario can be
1st marrying - 5 handset, 5 sim
2nd marrying(can be possible) 4 handset, 4 sim
the function should know how to pair the entry in the table..
Well !
So you need to click on row which is greater than 5th row.

Expand|Select|Wrap|Line Numbers
  1. function getSerializedSimLOV(obj)
  2. {
  3.  var row = obj.parentNode.parentNode.rowIndex;
  4.  var serials = document.getElementsByNames("hdnOrdersSerialNo");
  5.  var mobiles = document.getElementsByNames("hdnOrdersMobileNo");
  6.  if(row>4)
  7.   alert("Serial: " + serials[row-5].value + "\t" + "Mobile: " + mobiles[row-5].value);
  8.  else alert("Select the proper row");
  9. }
  10.  
Debasis Jana
Oct 11 '07 #31
Well !
So you need to click on row which is greater than 5th row.

Expand|Select|Wrap|Line Numbers
  1. function getSerializedSimLOV(obj)
  2. {
  3.  var row = obj.parentNode.parentNode.rowIndex;
  4.  var serials = document.getElementsByNames("hdnOrdersSerialNo");
  5.  var mobiles = document.getElementsByNames("hdnOrdersMobileNo");
  6.  if(row>4)
  7.   alert("Serial: " + serials[row-5].value + "\t" + "Mobile: " + mobiles[row-5].value);
  8.  else alert("Select the proper row");
  9. }
  10.  
Debasis Jana


but how about when there are
3 handsets 3 sims
3 handsets 3 sims
3 handsets 3 sims

how will i paired it..
Oct 11 '07 #32
dmjpro
2,476 2GB
but how about when there are
3 handsets 3 sims
3 handsets 3 sims
3 handsets 3 sims

how will i paired it..
Means if the on 6th row it is clicked then first row will be populated.
And if it is clicked on first row then, what?

Debasis Jana
Oct 11 '07 #33
Means if the on 6th row it is clicked then first row will be populated.
And if it is clicked on first row then, what?

Debasis Jana

function only is placed in the sim part.. when you clicked the12th row
the value wil be in 7th row, when you clicked the 18th row, the value will be in 13th row.
Oct 12 '07 #34
dmjpro
2,476 2GB
function only is placed in the sim part.. when you clicked the12th row
the value wil be in 7th row, when you clicked the 18th row, the value will be in 13th row.
Yeah I did that.
Hello ... Look at my code buddy.

12-5=7
13-5=8
.
.
18-5=13

Have a careful look.

Debasis Jana
Oct 12 '07 #35
Yeah I did that.
Hello ... Look at my code buddy.

12-5=7
13-5=8
.
.
18-5=13

Have a careful look.

Debasis Jana

this code??what if row is >3?

function getSerializedSimLOV(obj)
{
var row = obj.parentNode.parentNode.rowIndex;
var serials = document.getElementsByNames("hdnOrdersSerialNo");
var mobiles = document.getElementsByNames("hdnOrdersMobileNo");
if(row>4)
alert("Serial: " + serials[row-5].value + "\t" + "Mobile: " + mobiles[row-5].value);
else alert("Select the proper row");
}
Oct 12 '07 #36
dmjpro
2,476 2GB
this code??what if row is >3?

function getSerializedSimLOV(obj)
{
var row = obj.parentNode.parentNode.rowIndex;
var serials = document.getElementsByNames("hdnOrdersSerialNo");
var mobiles = document.getElementsByNames("hdnOrdersMobileNo");
if(row>4)
alert("Serial: " + serials[row-5].value + "\t" + "Mobile: " + mobiles[row-5].value);
else alert("Select the proper row");
}
Ahh ... Let me clear one thing ....Smiley.
Your click will start from 6th row, right?
So if row clicked before 6th then it ll alert a message... "Select the proper row".
Here the thing done !

Debasis Jana
Oct 12 '07 #37
Ahh ... Let me clear one thing ....Smiley.
Your click will start from 6th row, right?
So if row clicked before 6th then it ll alert a message... "Select the proper row".
Here the thing done !

Debasis Jana


Hi, i had came up with this code


Expand|Select|Wrap|Line Numbers
  1. function getSerializedSimLOV1(obj) {
  2.  
  3.     var varQuantityValue = document.crmForm.txtQuan.value;
  4.     varQuantityValue = parseInt(varQuantityValue);
  5.     var ctr = 0;
  6.     var varRowCount = document.getElementById('tblOrders').rows.length;
  7.     var handsetCounter = 0;
  8.     var simCounter = 0;
  9.     var varTemp = 0;
  10.     var z = 0;
  11.  
  12.     var row = obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex;
  13.     var mobiles = document.getElementsByName("hdnMIN");
  14.  
  15.     if (varRowCount > 1) {
  16.             for (ctr = 0; ctr<varRowCount; ctr++) {
  17.                var varMainCategoryCode = document.crmForm.hdnOrdersMainCategoryCode[z].value;
  18.  
  19.                     if (varMainCategoryCode == "HANDSET" ){ 
  20.                         handsetCounter++;
  21.                     } 
  22.  
  23.              z++;
  24.             }
  25.  
  26.         varTemp = row - handsetCounter;
  27.  
  28.         document.crmForm.hdnMIN[varTemp].value = mobiles[row].value;
  29.     }
  30. }
  31.  
this works for the first pair only,..

example:

when i add :

pair 1 - 1 handset 1sim
pair 2 - 1 handset 1 sim

pair 1 is good, it populate the pair handset 1
but when in pair 2, when i clicked sim 1 the value populated in pair 1 sim 1,
which should be in pair 2 handset 1....


Thanks for your help...
Oct 12 '07 #38
dmjpro
2,476 2GB
Well !

Please use Code tags.
Please explain me this code ..


Expand|Select|Wrap|Line Numbers
  1. if (varRowCount > 1) {
  2. for (ctr = 0; ctr<varRowCount; ctr++) {
  3. var varMainCategoryCode = document.crmForm.hdnOrdersMainCategoryCode[z].value;
  4.  
  5. if (varMainCategoryCode == "HANDSET" ){
  6. handsetCounter++;
  7. }
  8.  
  9. z++;
  10. }
  11.  
  12. varTemp = row - handsetCounter;
  13.  
What is the purpose of it?

Debasis Jana
Oct 12 '07 #39
Well !

Please use Code tags.
Please explain me this code ..


Expand|Select|Wrap|Line Numbers
  1. if (varRowCount > 1) {
  2. for (ctr = 0; ctr<varRowCount; ctr++) {
  3. var varMainCategoryCode = document.crmForm.hdnOrdersMainCategoryCode[z].value;
  4.  
  5. if (varMainCategoryCode == "HANDSET" ){
  6. handsetCounter++;
  7. }
  8.  
  9. z++;
  10. }
  11.  
  12. varTemp = row - handsetCounter;
  13.  
What is the purpose of it?

Debasis Jana
to get the row where the auto populate value will be place.
Oct 12 '07 #40
dmjpro
2,476 2GB
pair 1 is good, it populate the pair handset 1
but when in pair 2, when i clicked sim 1 the value populated in pair 1 sim 1,
which should be in pair 2 handset 1....
Actually I am not getting your point here.
Please explain me little bit more.

Debasis Jana.
Oct 12 '07 #41
Actually I am not getting your point here.
Please explain me little bit more.

Debasis Jana.
hi there, i just finished my code, and my module is now working, thanks for your all great ideas, sorry if i become lazy along the way. i didn't think what you said..

Thanks again

Gudluck and regrds to all.. :)
Oct 12 '07 #42
acoder
16,027 Expert Mod 8TB
smiley22, please use code tags in future when posting code.

[CODE=javascript]
JavaScript code goes here...
[/code]
Oct 15 '07 #43

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David Shorthouse | last post by:
HI is it posible to auto populate an access database.? I have 1 table structured Index_ID. - Index & auto number First_Name - Char50 Surname - Char50 Initals - Char50 Postcode - Char50...
2
by: C. David Rossen | last post by:
Hello: I have a registration form for classes. Each class has a fee. I have a drop down box whereby the user chooses his class. There is a textbox with the associated fee. I would like to...
1
by: Jason Galvin | last post by:
I would like to disable the auto-populating feature (remembers form element text between post-backs) when creating a .NET form. I have succeeded in disabling auto-populate by creating my controls...
0
by: Brian Henry | last post by:
I'm sure some of you ran into this already and wondered how to fix it. When you Have a solution that contains solution folders (the partially transparent folders that can hold groupings of...
1
by: Jim | last post by:
I have a new database in which I have a form where in one field I type a letter A, B, C or D and the field next to it autofills (auto lookups) with a description associated with the specific...
2
by: keri | last post by:
Hi, I'm still struggling with my tables - frustrating. If a field in table one is completed I want the following field to auto populate (dependng on the answer to the first field). I have...
2
by: des-sd | last post by:
Access Experts, Please help! I have looked through ref. manuals, Google Groups on "Auto Populate", and I am still lost. Problem #1 My DB is 2 relational tables of (1) sales transactions of,...
8
by: zeilak | last post by:
I am running Windows XP, Access 2002. I want to know the VB code for the following: I want to type in the ID # (it's the primary key and is auto-numbering) and then have the access form...
2
by: Ronald | last post by:
I hope somebody can help. I can't get into the specifics of my project, but I'll try to create a simple example: tblVehicle * VIN (text box) * Make (text box) * Model (text box) frmRepair
2
by: paulyXvpf | last post by:
Hi All, FACTS: > I've created a VB.NET 2005 form, with a SQL Server 2000 backend > The form has about 30 fields that populate 30 columns in the SQL database > The form has mostly text feilds,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.