Solved

javascript - modify element value

Posted on 2009-05-06
6
487 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now