Xpages - Call bean method on click of a button -
i have form displayed in read mode using custom control bound view scoped bean. need have picker on cc users can select other documents. these display links (generated using repeat control). planned trigger method in view scoped bean save value when selection changes.
now stuck with:
- onchange event of multi-valued field (used picker) not trigger ssjs code
- i tried creating button clicked using csjs on onchange of above field - not work either.
in short, ssjs code not being triggered.
this troubling me have created file download control wherein have added remove button calling method in bean , works fine.
i using debugtoolbar mark leusink , not able display simple message or set scope variable. happening onchange , onclick events!! have provided cc code below. if want can put in xpage bound view scoped bean.
<?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:panel id="panel1"> <xp:inputtextarea id="inputtextarea1" style="display:none" value="#{viewscope[compositedata.pickerdetails.beanname][compositedata.pickerdetails.savetofield]}" multipleseparator="," > <xp:eventhandler event="onchange" submit="true" refreshmode="partial" refreshid="repeatlinks"> <xp:this.action><![cdata[#{javascript://viewscope[compositedata.pickerdetails.beanname][compositedata.pickerdetails.savetofield]= getcomponent("inputtextarea1").getvalue(); //viewscope.get(compositedata.pickerdetails.beanname).setvalue(compositedata.pickerdetails.savetofield,getcomponent("inputtextarea1").getvalue()); //viewscope[compositedata.pickerdetails.beanname].linkdocs(compositedata.pickerdetails.savetofield,getcomponent("inputtextarea1").getvalue());}]]></xp:this.action> <xp:this.script><![cdata[//console.log("btn found : "+document.getelementbyid(getid("btnlinks"))); document.getelementbyid(getid("btnlinks")).click();]]></xp:this.script> </xp:eventhandler> </xp:inputtextarea> <xe:valuepicker id="valuepicker1" listheight="auto" listwidth="auto" dialogtitle="#{javascript:compositedata.pickerdetails.title}" for="inputtextarea1"> <xe:this.dataprovider> <xe:simplevaluepicker labelseparator="|"> <xe:this.valuelist><![cdata[#{javascript:var cd = compositedata.pickerdetails; getpickerlist(cd.viewname,cd.filter,cd.filterfield);}]]></xe:this.valuelist> </xe:simplevaluepicker> </xe:this.dataprovider> </xe:valuepicker> <xp:repeat id="repeatlinks" rows="30" var="doclink"> <xp:this.value><![cdata[#{viewscope[compositedata.pickerdetails.beanname][compositedata.pickerdetails.savetofield]}]]></xp:this.value> <xp:text escape="false" id="computedfield1"> <!-- link generated here --> </xp:text> <xp:br></xp:br> </xp:repeat> <xp:button value="click me" id="btnlinks" refreshid="repeatlinks" refreshmode="partial"> <xp:this.onclick><![cdata[#{javascript:viewscope[compositedata.pickerdetails.beanname].linkdocs(compositedata.pickerdetails.savetofield,getcomponent("inputtextarea1").getvalue());}]]></xp:this.onclick> </xp:button> </xp:panel> </xp:view>
you mention custom control. cause validation failure elsewhere on page. button calls ssjs without execmode="partial"
, execid
. means complete xpage validated during partial refresh. refreshid doesn't include errors block, there's nothing alert user (and you!) if there validation error.
setting execmode="partial"
, execid="panel1"
on button should resolve problem.
if that's case, future recommend adding phaselistener applications can output phases being triggered and/or ensuring refresharea includes errors control.
Comments
Post a Comment