Solved

javascript - modify element value

Posted on 2009-05-06
6
489 Views
Last Modified: 2012-08-14
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

0
Comment
Question by:larksys
  • 3
  • 3
6 Comments
 
LVL 16

Expert Comment

by:duncancumming
ID: 24318662
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
 
LVL 1

Author Comment

by:larksys
ID: 24318719
My apologies.  I had a single = and got the error "invalid assignment left hand side".  

   document.getElementById("insertClistID") = clistID;      
0
 
LVL 16

Accepted Solution

by:
duncancumming earned 500 total points
ID: 24318797
try
document.getElementById("insertClistID").value = clistID;    

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 1

Author Comment

by:larksys
ID: 24319005
Too simple. Many thanks. Any idea why my grid does not refresh? Or should I post a second question?
0
 
LVL 16

Expert Comment

by:duncancumming
ID: 24319030
yeah do that as a second related question, because I don't know the answer to that one!
0
 
LVL 1

Author Closing Comment

by:larksys
ID: 31578676
Many thanks.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question