javascript - Calling XSP.partialRefreshPost on tokeninput field -
i'm trying implement jquery tokeninput plugin xpages app using examples mark rodens site. i've been going , forth on couple of problems can't seem over.
1) validation on inputtext2 field called regardless of immediate parameter xsp.partialrefreshpost call 2) value selected not binding source document (in case document1.appname).
here's code (forgive mess)
<xp:panel id="panel1"> <xp:inputtext id="inputtext1" value="#{document1.appname}"> </xp:inputtext> <xp:scriptblock id="scriptblock3"> <xp:this.value><![cdata[ $(document).ready(function() { $("#[id$=inputtext1]").tokeninput([{ "first_name": "arthur", "last_name": "godfrey", "email": "arthur_godfrey@nccu.edu", "url": "https://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png" }, { "first_name": "adam", "last_name": "johnson", "email": "wravo@yahoo.com", "url": "https://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png" }, { "first_name": "jeff", "last_name": "johnson", "email": "bballnine@hotmail.com", "url": "https://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png" }, { "first_name": "adriana", "last_name": "jameson", "email": "adriana.jameson@gmail.com", "url": "https://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png" } ], { tokenlimit: 1, propertytosearch: "first_name", onadd: function (item) { alert(item.first_name); var idp = "#{id:panel1}"; document.getelementbyid("#{id:inputtext1}").value = item.first_name xsp.partialrefreshpost(idp, {immediate:true}); }, }); }); ]]></xp:this.value> </xp:scriptblock> getcomponent=<xp:text escape="true" id="computedfield1"> <xp:this.value><![cdata[#{javascript:getcomponent("inputtext1").getvalue()}]]></xp:this.value> </xp:text> <xp:br></xp:br> document1.appname= <xp:text escape="true" id="computedfield2" value="#{document1.appname}"> </xp:text> <xp:br></xp:br> <xp:inputtext id="inputtext2" required="true"> <xp:this.validators> <xp:validaterequired message="please enter value"></xp:validaterequired> </xp:this.validators></xp:inputtext> <xp:message id="message1" for="inputtext2"></xp:message></xp:panel>
the way can value stick anywhere set field directly using value of item selected in onadd event. call xsp.partialrefreshpost in order refresh panel , display bound value in computed text field.
any ideas may missing? i'm sure it's stupid!
Comments
Post a Comment