| Author |
mandatory to enter particular value in the dynamic row
|
kesava chaitanya
Ranch Hand
Joined: Aug 15, 2001
Posts: 140
|
|
function handleCharges() { var tableObj= document.getElementById("CANChargesTable"); var counter=0; for(var i=1;i<tableObj.getAttribute("idcounter");i++) { var chargeObj= document.getElementById("charge"+i); if(chargeObj==null || chargeObj.value.length==0 || document.getElementById("invoiceIndicator"+i).value=="Y" || document.getElementById("chargeType"+i).value=="VIEW") continue; var chargeIndex = 1; if(i>chargeIndex) { if(counter >= 1) return showErrorMessage(chargeObj.id,"045 Freight Charge(s) should not be used twice."); if(chargeObj.value == "045") counter++; } } return true; } i am calling this function in validForm() of form tag when user clicks Refresh and submit button in our application we have the facility of creating dynamic rows;this dynamic rows working fine; "CANChargesTable" is table id; tableObj.getAttribute("idcounter") will get the how many dynamic rows u have created; in the dynamic rows i have the facility of entering chargeid's and charge desc etc..; i want to write a logic in this function in such a way that when user cannot enter chargeid '045' more than once; in two dynamic rows in one row i enter chargeid is 045 and another dynamic row i enter again charge id 045 and clicks refresh i have written this function so that user cannot enter chargeid 045 morethan once (Is this logic fine?) if(i>chargeIndex) { if(counter >= 1) return showErrorMessage(chargeObj.id,"045 Freight Charge(s) should not be used twice."); if(chargeObj.value == "045") counter++; } but user has to enter chargeid 045 atleast once if user doesnot enter 045 chargeid in dynamic rows and clicks refresh then i want him to show a message "User has to enter 045 chargecode" [ November 23, 2004: Message edited by: kesava chaitanya ]
|
 |
Yuriy Fuksenko
Ranch Hand
Joined: Feb 02, 2001
Posts: 413
|
|
|
I am sorry, what are you asking?
|
 |
 |
|
|
subject: mandatory to enter particular value in the dynamic row
|
|
|