By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,934 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,934 IT Pros & Developers. It's quick & easy.

tr.cells is undefined

P: 2
Hello,
I've got a table, with a cell you can click in every line.
When clicked, a popup containing a form shows up.
When submitting the form, I'd like to change the background color of the cell I've just clicked. However, the code below doesn't work, and I'd like to know what's wrong (the popup is included once in the ftl file):

Thanks !

/************* html *************/
Expand|Select|Wrap|Line Numbers
  1. <td onclick="openCall(${i.id}, '${i.askable.label}', '${telephone}', this.parentNode)">
  2. ...
  3. </td>
  4.  
/************ pop-up ************/
Expand|Select|Wrap|Line Numbers
  1. <div style="clear:both"></div>
  2. <div class="lightBox" style="display:none" id="popupCallBackground"></div>
  3.  
  4. <div class="popupLightBox" style="display:none" id="popupCall">
  5.     <div class="popupLightBoxTop">
  6.         <div class="popupLightBoxTitle">
  7.             Téléphone de l'entreprise <span id="askableLabel"></span>
  8.         </div>
  9.     </div>
  10.     <div class="popupLightBoxContent">
  11.  
  12.         Téléphone : <span id="telephoneCall"></span><br/>
  13.         <form id="callForm" action="">
  14.         <input type="submit" value="oui"/>&nbsp;&nbsp;&nbsp;<input type="button" value="non" onclick="closeCall()"/>
  15.         </form>
  16.     </div>
  17.     <div class="popupLightBoxBottom">
  18.     </div>
  19.  
  20. </div>
  21.  
/********** javascript **********/
Expand|Select|Wrap|Line Numbers
  1. function openCall(id, askableLabel, telephone, tr){
  2.     $('popupCallBackground').show();
  3.     $('popupCall').show();
  4.     new Draggable('popupCall', {zindex: 5});
  5.     $('askableLabel').update(askableLabel);
  6.     $('telephoneCall').update(telephone);
  7.     $('callForm').action="javascript:callPassed("+id+", '"+tr+"')";
  8. }
  9.  
  10. function closeCall(){
  11.     $('popupCallBackground').hide();
  12.     $('popupCall').hide();
  13. }
  14.  
  15. function callPassed(id, tr){
  16.     var fin=new Date().format();
  17.     tr.cells[4].innerHTML="passé le :<br/>"+fin;
  18.     tr.cells[4].style.background="teal";
  19.     AdminService.updatePhoneCall(id, function(data){
  20.  
  21.     });
  22. }
  23.  
Aug 19 '09 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
This line
Expand|Select|Wrap|Line Numbers
  1. $('callForm').action="javascript:callPassed("+id+" , '"+tr+"')";
is wrong. Doing "+id+" will pass the string '+id+', when I think you intended to concatenate the object into the argument. Simply remove the quotes and the plus signs, and the object will be passed properly (do the same for the tr, too).
Aug 19 '09 #2

P: 2
When I do this

Expand|Select|Wrap|Line Numbers
  1.    1. $('callForm').action="javascript:callPassed("+id+" , tr)";
  2.  
it says :
tr is not defined
Aug 19 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.