Originally posted by dmjpro
auto populate
Collapse
X
-
Originally posted by dmjprook....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 codeComment
-
Originally posted by smiley22but 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 getSerializedSi mLOV1(obj)
{
var row = obj.parentNode. parentNode.rowI ndex;
var serials = document.getEle mentsByName("hd nOrdersSerialNo ");
var mobiles = document.getEle mentsByName("hd nOrdersMobileNo ");
alert('row' + row);
alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
}Comment
-
this is the code that generate the rows of the table when the add button is clicked,Originally posted by dmjproPart by Part send me ......
Debasis Jana
the tdOrdersSerialN o and tdOrdersMobileN O contains the button and inputext
[CODE=javascript] tdElementSet = document.create Element('td');
tblElementSet1 = document.create Element('table' );
tbodyElementSet 1 = document.create Element('tbody' );
trElementSet1 = document.create Element('tr');
tdElementSet.wi dth = '740';
tblElementSet1. id = varSetTbl2ID + varGlobalRowCou nter;
tblElementSet1. width = '740';
tblElementSet1. className = 'tableList2';
tblElementSet1. border = '0';
tblElementSet1. cellPadding = '0';
tblElementSet1. cellSpacing = '1';
//tblElementSet1. setAttribute('c ellpadding', '0');
//tblElementSet1. setAttribute('c ellspacing', '1');
tbodyElementSet 1.id = varSetTbody2ID + varGlobalRowCou nter;
varGlobalRowCou nterString = varGlobalRowCou nter;
varGlobalRowCou nt = 1;
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersCheckb ox';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'center';
tdElementSet1.a lign = 'center';
tdElementSet1.w idth = '23';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
tdElementSet1.i nnerHTML = '<input type="checkbox" name="checkbox" value="">'
+ '<input type="hidden" name="hdnOrders ItemSetFlag" value="' + varItemSetFlag + '">'
+ '<input type="hidden" name="hdnOrders GlobalRowCounte r" value="' + varGlobalRowCou nterString + '">'
+ '<input type="hidden" name="hdnOrders GlobalRowCount" value="' + varGlobalRowCou nt + '">'
+ '<input type="hidden" name="hdnOrders DocOwnerCode" value="' + varDocOwnerCode + '">'
+ '<input type="hidden" name="hdnOrders BundledCode" value="' + varBundledCode + '">'
+ '<input type="hidden" name="hdnOrders AllowNegativeFl ag" value="' + varAllowNegativ eFlag + '">'
+ '<input type="hidden" name="hdnOrders MainCategoryCod e" value="' + varMainCategory Code + '">'
+ '<input type="hidden" name="hdnOrders SIMFlag" value="' + varSIMFlag + '">'
+ '<input type="hidden" name="hdnOrders BundlingCounter " value="' + varBundlingCoun ter + '">'
+ '<input type="hidden" name="hdnOrders BundlingRemoval Flag" value="' + varBundlingRemo valFlag + '">';[/code]
[code=javascript]trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersItemCo de';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'left';
tdElementSet1.w idth = '84';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
tdElementSet1.i nnerHTML = ' ' + varItemCode + '<input type="hidden" name="hdnOrders ItemCode" id="hdnOrdersIt emCode' + (varGlobalRowCo unter + 1) + '" value="' + varItemCode + '">';
//tdElementSet1.i nnerHTML = ' ' + varPlanCode + '<input type="hidden" name="hdnOrders PlanCode" id="hdnOrdersPl anCode' + (varGlobalRowCo unter + 1) + '" value="' + varPlanCode + '">'
trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersItemDe sc';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'left';
tdElementSet1.w idth = '128';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
tdElementSet1.i nnerHTML = ' ' + varItemDesc + '<input type="hidden" name="hdnOrders ItemDesc" value="' + varItemDesc + '">'
+ '<input type="hidden" name="hdnOrders ItemTypeCode" value="' + varItemTypeCode + '">'
+ '<input type="hidden" name="hdnOrders ItemSetHeaderID " value="' + varItemSetHeade rID + '">'
+ '<input type="hidden" name="hdnOrders GlobalRowIndex" value="' + varGlobalRowCou nter + '">'
+ '<input type="hidden" name="hdnOrders SubSLOCCode" id="hdnOrdersSu bSLOCCode' + (varGlobalRowCo unter + 1) + '"value="' + varSubSLOCCode + '">'
+ '<input type="hidden" name="hdnOrders EntCode" value="' + varEntCode + '">'
+ '<input type="hidden" name="hdnOrders EntAmt" value="' + varEntAmt + '">'
+ '<input type="hidden" name="hdnOrders PriceTypeCode" value="' + varPriceTypeCod e + '">'
+ '<input type="hidden" name="hdnDummyF lag" value="' + varDummyFlag + '">';[/code]
[code=javascript]trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersSerial No';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'left';
tdElementSet1.w idth = '123';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
/*if ( varMainCategory Code == "SIM") {
tdElementSet1.i nnerHTML = '<input type="button" class="inputBut ton" name="btnItemDe tails" id="btnItemDeta ils" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSer ializedSimLOV(' + (varGlobalRowCo unter + 1) + ')">';
}
else if (varMainCategor yCode =="HANDSET")
tdElementSet1.i nnerHTML = '<input type="button" class="inputBut ton" name="btnItemDe tails" id="btnItemDeta ils" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSer ializedHandsetL OV(' + (varGlobalRowCo unter + 1) + ')">';
*/
if (varMainSlocReq Serial == "1") {
//serial
if ((varAttriIMEI == 0 && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmFo rm.chkDummy.che cked == true))
tdElementSet1.i nnerHTML = ' ' + '<input type="hidden" size="16" class="mandator y" align ="center" maxlength="16" name="hdnSerial No" value="' + varSerialNo + '">';
else {
if ( varMainCategory Code == "HANDSET") {
tdElementSet1.i nnerHTML = ' ' + '<input type="text" size="16" class="mandator y" align ="center" maxlength="16" name="hdnSerial No" value="' + varSerialNo + '">'
+ ' ' + '<input type="button" class="inputBut ton" name="btnItemDe tails" id="btnItemDeta ils" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSer ializedHandsetL OV(' + (varGlobalRowCo unter + 1) + ')">'
+ '<input type="hidden" class="hidden" name="hdnglobal " id="hdnglobal" value="' + (varGlobalRowCo unter + 1) + '">';
}
else if ( varMainCategory Code == "SIM") {
tdElementSet1.i nnerHTML = ' ' + '<input type="text" size="16" class="mandator y" align ="center" maxlength="16" name="hdnSerial No" value="' + varSerialNo + '">'
+ ' ' + '<input type="button" class="inputBut ton" name="btnItemDe tails" id="btnItemDeta ils" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSer ializedSimLOV(' + (varGlobalRowCo unter + 1) + ');getSerialize dSimLOV1">'
+ '<input type="hidden" class="hidden" name="hdnglobal " id="hdnglobal" value="' + (varGlobalRowCo unter + 1) + '">';
}
}
}
else {
if ((varAttriIMEI == 0 && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmFo rm.chkDummy.che cked == true))
tdElementSet1.i nnerHTML = ' ' + '<input type="hidden" size="16" class="mandator y" align ="center" maxlength="16" name="hdnSerial No" value="' + varSerialNo + '">';
else
tdElementSet1.i nnerHTML = ' ' + '<input type="text" size="16" class="mandator y" align ="center" maxlength="16" name="hdnSerial No" value="' + varSerialNo + '">'
}[/code]
[code=javascript]trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersMobile No';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'left';
tdElementSet1.w idth = '120';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
if (varMainSlocReq Serial == "1") {
if ((varAttriIMEI == 0 && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmFo rm.chkDummy.che cked == true))
tdElementSet1.i nnerHTML = ' ' + '<input type="hidden" size="14" name="hdnMIN" align="center" maxlength="10" class="mandator y" value="' + varMIN + '">';
else {
if ( varMainCategory Code == "SIM" ) {
tdElementSet1.i nnerHTML = ' ' + '<input type="text" size="16" class="mandator y" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">'
+ ' ' + '<input type="button" class="inputBut ton" name="btnItemDe tails" id="btnItemDeta ils" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSer ializedSimLOV(' + (varGlobalRowCo unter + 1) + ')">';
}
else if (( varMainCategory Code == "HANDSET") && (document.getEl ementById("nc") .checked == true)) {
tdElementSet1.i nnerHTML = ' ' + '<input type="text" size="16" class="mandator y" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">'
+ ' ' + '<input type="button" class="inputBut ton" name="btnItemDe tails" id="btnItemDeta ils" value="..." style="WIDTH: 15px; HEIGHT: 16px" onClick="getSer ializedMinLOV(' + (varGlobalRowCo unter + 1) + ')">';
} else if (document.getEl ementById("rn") .checked == true) {
tdElementSet1.i nnerHTML = ' ' + '<input type="text" size="16" class="mandator y" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">';
}
}
}
else {
if ((varAttriIMEI == 0 && varAttriICCID == 0 && varAttriMIN == 0 ) || (document.crmFo rm.chkDummy.che cked == true))
tdElementSet1.i nnerHTML = ' ' + '<input type="hidden" size="14" name="hdnMIN" align="center" maxlength="10" class="mandator y" value="' + varMIN + '">';
else
tdElementSet1.i nnerHTML = ' ' + '<input type="text" size="16" class="mandator y" align ="center" maxlength="10" name="hdnMIN" value="' + varMIN + '">';
}
trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersTranTy peCode';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'left';
tdElementSet1.w idth = '70';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
tdElementSet1.i nnerHTML = ' ' + varTranTypeCode + '<input type="hidden" name="hdnOrders TranTypeCode" value="' + varTranTypeCode + '">';
trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersPlanCo de';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'left';
tdElementSet1.w idth = '68';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
tdElementSet1.i nnerHTML = ' ' + varPlanCode + '<input type="hidden" name="hdnOrders PlanCode" value="' + varPlanCode + '">'
+ '<input type="hidden" name="hdnOrders PlanAmt" value="' + varPlanAmt + '">';
trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersQuanti ty';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'right';
tdElementSet1.w idth = '40';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
tdElementSet1.i nnerHTML = ' ' + varFormattedQua ntity + '<input type="hidden" name="hdnOrders Quantity" value="' + varQuantity + '">';
trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersItemTo talAmt';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'bottom';
tdElementSet1.a lign = 'right';
tdElementSet1.w idth = '84';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';
tdElementSet1.i nnerHTML = ' ' + varItemTotalAmt + '<input type="hidden" name="hdnOrders ItemTotalAmt" value="' + varItemTotalAmt + '">'
+ '<input type="hidden" name="hdnOrders ItemAmt" value="' + varItemAmt + '">'
+ '<input type="hidden" name="hdnOrders StdItemAmt" value="' + varStdItemAmt + '">'
+ '<input type="hidden" name="hdnOrders Discount" value="' + varDiscount + '">'
+ '<input type="hidden" name="hdnOrders TotalDiscount" value="' + varOrdersTotalD iscount + '">'
+ '<input type="hidden" name="hdnOrders PricingID" value="' + varPricingID + '">';
trElementSet1.a ppendChild(tdEl ementSet1);
tdElementSet1 = document.create Element('td');
tdElementSet1.i d = 'tdOrdersItemDe tails';
//tdElementSet1.b gcolor = '#ffffff';
tdElementSet1.v align = 'center';
tdElementSet1.a lign = 'center';
tdElementSet1.w idth = '23';
//tdElementSet1.h eight = '24';
tdElementSet1.c lassName = 'tableList2';[/code]
[code=javascript]trElementSet1.a ppendChild(tdEl ementSet1);
tbodyElementSet 1.appendChild(t rElementSet1);
tblElementSet1. appendChild(tbo dyElementSet1);
tdElementSet.ap pendChild(tblEl ementSet1);
trElement.appen dChild(tdElemen tSet);
tableBody.appen dChild(trElemen t);
varGlobalRowCou nter++;
/*
if ((varBundledCod e == null) || (varBundledCode == "null") || (varBundledCode .length == 0)) {
varGlobalBundli ngCounter++;
}
*/
document.crmFor m.chkDummy.chec ked = false;
varSuccessfulAd dRow = true;
//}
}
javascript:
function getSerializedSi mLOV1(obj)
{
var row = obj.parentNode. parentNode.rowI ndex;
var serials = document.getEle mentsByName("hd nOrdersSerialNo ");
var mobiles = document.getEle mentsByName("hd nOrdersMobileNo ");
alert('row' + row);
alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
}[/CODE]Comment
-
Originally posted by dmjproSorry "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 "varGlobalRowCo unter" ?
Debasis Jana
:(
the code inserts a row in a table together with its column..
varGlobalCounte r??i used it in other functionality of my programComment
-
Hey I got that.Originally posted by dmjpro"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 "getSerializedS imLOV()" 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.
[code=html]
<input type="button" name="btnItemDe tails" id="btnItemDeta ils" onClick="getSer ializedSimLOV(t his)>
[/code]
[code=javascript]
function getSerializedSi mLOV(obj)
{
var row = obj.parentNode. parentNode.rowI ndex;
var serials = document.getEle mentsByNames("h dnOrdersSerialN o");
var mobiles = document.getEle mentsByNames("h dnOrdersMobileN o");
alert("Serial: " + serials[row-1] + "\t" + "Mobile: " + mobiles[row-1]);
}
[/code]
Have a try with this.
Good Luck !
Debasis Jana
[code=javascript]
alert("Serial: " + serials[row] + "\t" + "Mobile: " + mobiles[row]);
[/code]
Make this changes, you will get the result.
Debasis JanaComment
-
Then simply access it's attributes ........... buddy :)Originally posted by smiley22its alerts as an object.. serials[object], mobiles[object]
Actually you are getting perfect object, what you need for then access their properties using "." operator.
Debasis JanaComment
-
Originally posted by dmjproOk............. 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..Comment
-
---Originally posted by smiley22the 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 - hdnOrdersMainCa tegoryCode
im confused how to group the items and paired them their corresponding min.Comment
Comment