Reputation: 123
It is embarrassing that I am having these 'newby' questions a lot, as I am late to the XPages rodeo for real work. Please be gentle.
This is BASIC functionality, needing to have a field that is initially hidden on new pages, until another combobox gets set to a certain value (think of any generic 'other' field, that is only displayed if "Other" is selected in the main field.).
Behold..my panel:
<xp:panel
id="mod"
rendered="#{javascript:document1.getItemValueString('approval') === 'modify'}">
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label for="modification">
Describe modification
</label>
<xe:djTextarea
id="modification"
styleClass="form-control"
cols="185"
rows="25">
</xe:djTextarea>
</div>
</div>
</div>
</div>
</xp:panel>
then, my combobox (see onchange):
<xp:comboBox
id="approval"
styleClass="form-control"
style="width:400px;">
<xp:this.onchange>
<![CDATA[XSP.partialRefreshPost("#{id:mod}");]]>
</xp:this.onchange>
<xp:selectItem
itemLabel="Select one"
itemValue="">
</xp:selectItem>
<xp:selectItem
itemLabel="Approve"
itemValue="approve">
</xp:selectItem>
<xp:selectItem
itemLabel="Modify"
itemValue="modify">
</xp:selectItem>
When I change the value of the combobox in the browser, I get this error in a dialog:
I have a feeling that once I get a better grasp on how to deal with SSJS and element IDs, I will be much more productive. If anyone has a link to an article that explains this well, I would love to know it.
After all that rambling, question is how do I get this partial refresh to work?
As always, your feedback is truly appreciated.
Upvotes: 0
Views: 63
Reputation: 827
The problem is the "mod" panel is not initially rendered so its not available/visible to the onchange event.
Put the "mod" panel in a "modParent" panel and make that the target of your partialRefresh.
Upvotes: 2