javascript - modify element value

I need to change the value of an input element on a form.  I'm not sure why my code doesn't work. Using Firebug, I can tell that the value of the variable clistID is indeed 212 (correct value).  But the form element insertClistID does not end up with that value.
function selectCallList(grid,rowIndex,e){
   var record = grid.getDataSource().getAt(rowIndex);
   var row = grid.getDataSource().getAt(rowIndex);
   var clistID = row.data.ID;
   console.log(clistID);
   document.formDspMailer.getElementById("insertClistID") == clistID;	
   ColdFusion.Ajax.submitForm('formDspMailer', 'CallListInsert.cfm', resultInsertHandler, insertErrorHandler); 
   ColdFusion.Grid.refresh('MailerCallListGrid', 'true');
   // console.log(clistID);
}	
</script>

Open in new window

LVL 1
larksysAsked:
Who is Participating?
 
duncancummingConnect With a Mentor Commented:
try
document.getElementById("insertClistID").value = clistID;    

0
 
duncancummingCommented:
document.formDspMailer.getElementById("insertClistID") == clistID;

a == b means check a is equal to b

In this case you want to use a single = sign,
a = b
which means set a to the value of b

document.formDspMailer.getElementById("insertClistID") = clistID;
0
 
larksysAuthor Commented:
My apologies.  I had a single = and got the error "invalid assignment left hand side".  

   document.getElementById("insertClistID") = clistID;      
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
larksysAuthor Commented:
Too simple. Many thanks. Any idea why my grid does not refresh? Or should I post a second question?
0
 
duncancummingCommented:
yeah do that as a second related question, because I don't know the answer to that one!
0
 
larksysAuthor Commented:
Many thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.