+ Start a Discussion

Javascript error with simple apex:relatedList (multi-select) in VF page



we get a Javascript error when we add an apex:relatedList with a multi-select list button to a VF page. It works in Firefox but not IE7 or IE8.


It can be reproduced with a few steps:


  • - Create a custom object related to Account
  • - Add a custom list button to the object and check
      Display Checkboxes (for Multi-Record Selection)
  • - Add the list button to the related list on the Account page layout


Create this simple VF page:


<apex:page standardController="Account"> <apex:relatedList subject="{!Account.Id}" list="RelatedListTest__r"/> </apex:page>



When you open the page you get the javascript error "Expected ')'. It makes no difference if it is a VF, S-Control or Javascript list button, it always happens if there is at least on button with multi-select checked.


Is there a workaround or is it a bug in the page rendering that only SFDC can fix ?





Message Edited by Forcecode on 12-10-2009 02:28 AM
Message Edited by Forcecode on 12-10-2009 02:31 AM
Message Edited by Forcecode on 12-10-2009 03:19 AM

This appears to be caused by VF using colons in dom IDs, then referring to those dom IDs as javascript identifiers. Ex:



<form  action="" id="massActionForm_page:j_id98" method="POST" name="massActionForm_page:j_id98" onsubmit="return verifyChecked(massActionForm_page:j_id98, 'ids', 'Please select at least one row')" >


massActionForm_page:j_id98 is not a valid javascript identifier, yet it's being passed into verifyChecked. Some implementations complain about this (IE), some don't.


Is there a way to prevent VF from doing this?