You need to sign in to do that
Don't have an account?
drewpiston.ax678
Javascript parameter in chrome not working
I've got a component that's inside of a repeat tag. Inside the component, there's a javascript method called from a command link that opens a pop up window. The method passes in the id of a record that the component receives as an attribute.
This works great in firefox/ie, but in chrome it uses the id of the first record every time. Any ideas?
Visual force component (partial):
<apex:component controller="AssessmentQuestion" allowDML="true"> <apex:attribute name="questionitem" description="Assessment Question" type="QuestionItem" assignTo="{!qi}" required="true"/> <apex:attribute name="isreadonly" description="Read Only" type="Boolean" assignTo="{!isreadonly}" required="false"/> <apex:attribute name="pageController" type="PageControllerBase" assignTo="{!pageController}" required="false" description="The controller for the page." /> <!-- Display error text --> <!--apex:outputText value="{!questionErrorText}" rendered="{!QuestionError}"/--> <!-- Non-question group question-response --> <apex:outputPanel rendered="{!NOT(QuestionGroup)&&renderQuestion==true}"> <table width="100%" border="0" cellspacing="5" > <tr> <td width="10%" align="left" valign="middle"> <apex:commandLink value="IRIS Definition" style="font-size:80%" onclick="openQuestionMessagePopup('{!qi.question.id}','IRIS Definition')" title="Click to see IRIS definition." immediate="true" id="irisdef" rendered="{!NOT(ISBLANK(question.IRIS_Definition__c))}"/> etc...
Javascript method:
var newQuestionMessageWin=null; function openQuestionMessagePopup(qid, msgtype) { var url="./apex/QuestionMessage?id=" + qid + "&msgtype=" + msgtype; newQuestionMessageWin=window.open(url, 'QuestionMessagePopup','height=150,width=500,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no,menubar=no,location=no'); newQuestionMessageWin.focus(); return false; }
Thanks,
Drew
I found a issue with this design in this case if you have 20 items in repeat it will add this script method "openQuestionMessagePopup" 20 times in your page, one for each component, I would suggest use this JS function in your page , I think this change will also fix your issue.
Let me know if any issues in it.
Hi Shashikant,
Yes, I neglected to make it clear that the javascript message is in the visualforce page that includes the component, not the component itself. So I'm not having an issue with 20 script methods, but the problem I described is still occuring.
Thanks,
Drew
Just thought I'd post one more time and see if anyone has ideas. If not, no worries, I'll keep working on a workaround.
Drew