Solved

javascript - modify element value

Posted on 2009-05-06
6
490 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
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…

828 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