Chrome and Safari dont like this construct...
tony.herstell1 Oct 26, 2010 5:12 AMI needed a construct to show/hide parts of page in a nice usable way (nice effect etc).
Had to encode a UID on front of method name as RF does not give each occurance a unique id (why?).
So...
Given decorator (used a few times on 1 page):
<s:decorate template="/WEB-INF/pages/showHideArea.xhtml">
<ui:param name="startOpen" value="false" />
<ui:param name="UID" value="products" />
<ui:define name="leaderText">Licensed Products</ui:define>
<ui:define name="contentText">
Blah blah blah
</ui:define>
</s:decorate>
Using decorator template showHideArea.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich" >
<table>
<tr>
<td>
<h3>
<ui:insert name="leaderText"/>
</h3>
</td>
<td>
<s:div id="#{UID}showButton" style="#{startOpen ? 'display: none;' : ''}">
<input type="button" value="Show" onclick="#{UID}_showContentDiv(); #{UID}_hideShowButton()" />
</s:div>
</td>
</tr>
</table>
<div id="#{UID}contentArea" style="#{startOpen ? '' : 'display: none;'}">
<ui:insert name="contentText"/>
<input type="button" value="Hide" onclick="#{UID}_hideContentDiv(); #{UID}_showShowButton()"/>
</div>
<rich:effect for="#{UID}contentArea" name="#{UID}_showContentDiv" type="BlindDown" />
<rich:effect for="#{UID}contentArea" name="#{UID}_hideContentDiv" type="BlindUp" />
<rich:effect for="#{UID}showButton" name="#{UID}_showShowButton" type="Appear" />
<rich:effect for="#{UID}showButton" name="#{UID}_hideShowButton" type="Fade" />
</ui:composition>
This works fine in FF and IE
But Chrome and Safare Bawlk!
- Uncaught ReferenceError: params is not defined
- (anonymous function):1
- Richfaces.effect.createa4j/g/3_3_3.Finalorg/richfaces/renderkit/html/script/processEffect.js:8
- (anonymous function)
if(!window.Richfaces){window.Richfaces={};}
Richfaces.processEffect=function(params){new Effect[params.type]($(params.targetId),params);};Richfaces.effectEventOnOut=function(ename){return ename.substr(0,2)=='on'?ename.substr(2):ename;};if(!Richfaces.effect){Richfaces.effect={};}
Richfaces.effect.create=function(options){if(!options)options={};var params=options.params||{};options.params=null;var attachObj;var targetObj;var targetId=options.targetId;var attachId=options.attachId;if(options.attachObj){try{attachObj=eval(options.attachObj);}catch(e){}
if(typeof attachObj=='object'){attachId=attachObj;}}
if(options.targetObj){try{targetObj=eval(options.targetObj);}catch(e){}
if(typeof targetObj=='object')targetId=targetObj;}
if(!targetId)targetId=attachId;if(!params.targetId)params.targetId=targetId;params.type=options.type;if(!options.event){with(window){eval(options.name+"=function(){return Richfaces.processEffect(Object.extend(this,arguments[0]||{}));}.bind(params)");}}else{var ename=Richfaces.effectEventOnOut(options.event||"");if(ename){var bindedFunction=function(event){return Richfaces.processEffect(this);}.bindAsEventListener(params);Event.observe(attachId,ename,bindedFunction,params.useCapture||false);}}}
Presing one of buttons on page causes
- Uncaught ReferenceError: services_showContentDiv is not defined
- (anonymous function)home.seam:125
- onclick
Any ideas?