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 =;
   document.formDspMailer.getElementById("insertClistID") == clistID;	
   ColdFusion.Ajax.submitForm('formDspMailer', 'CallListInsert.cfm', resultInsertHandler, insertErrorHandler); 
   ColdFusion.Grid.refresh('MailerCallListGrid', 'true');
   // console.log(clistID);

Open in new window

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

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;
larksysAuthor Commented:
My apologies.  I had a single = and got the error "invalid assignment left hand side".  

   document.getElementById("insertClistID") = clistID;      
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

larksysAuthor Commented:
Too simple. Many thanks. Any idea why my grid does not refresh? Or should I post a second question?
yeah do that as a second related question, because I don't know the answer to that one!
larksysAuthor Commented:
Many thanks.
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.