Solved

javascript - modify element value

Posted on 2009-05-06
6
492 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

719 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