Programmatically set DojoAttributes on a ServerSide Component


<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
	xmlns:xe="http://www.ibm.com/xsp/coreex">
	<xp:inputText id="inputText1"></xp:inputText>
	<xp:button value="Label" id="button1">
		<xp:eventHandler event="onclick" submit="true"
			refreshMode="complete">
			<xp:this.action>
				<![CDATA[#{javascript:
					var c = getComponent("inputText1");
					if(null != c){
						c.setDojoType("my.element.type");
						var a = new com.ibm.xsp.dojo.DojoAttribute();
						a.setName("my-attr-name");
						a.setValue("my-attr-value");
						c.addDojoAttribute(a);
					}
				}]]>
			</xp:this.action>
		</xp:eventHandler>
	</xp:button>
</xp:view>
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...