Refresh XPage

Hi There (again!)

Looking to refresh the current page after a value has been selected in a combo box.

I have various ‘Display Whens’ and would like the page to refresh when a value has been selected.

Example :

Problem Type : Printer

Printer Name :

Printer Name should then appear when the user has selected ‘Printer’. I know there are some ‘OnChange’ events, but its what to set that to, or what script to use?

Thanks for any help.

Jamie

P.S. Here is my code for the DisplayWhen :

FLSCall.ProbType == “Printers / Printing Services”

it is working ok, i am just looking how to refresh the page but keep the values I have already entered.

Subject: Try partial refresh

The xpage just needs to be submitted to get the new value for ‘Printer’ to display in the field.

However, this may not what you want to do as the document gets submitted along side this action. So try using partial refresh - submitting and refreshing a small part on the XPage like the label for the ‘Printer’

Try this…

<xp:label value="What's selected in the Combo: " id="label1"></xp:label>

<xp:text escape="true" id="computedField1" value="#{requestScope.val01}"

	style="font-weight:bold;margin-left:5px"></xp:text>

<xp:br></xp:br>

<xp:comboBox id="comboBox1" value="#{requestScope.val01}">

	<xp:selectItem itemLabel="None Selected" itemValue=""></xp:selectItem>

	<xp:selectItems>

		<xp:this.value><![CDATA[${javascript:return ["Apples", "Bananas", "Cranberries"]}]]></xp:this.value>

	</xp:selectItems>

	<xp:eventHandler event="onchange" submit="true"

		refreshMode="partial" refreshId="computedField1">

	</xp:eventHandler>

</xp:comboBox>

Add this to the source and see how it’s done in Designer.

Have a search through the Wiki and blogs to see more tips on this.

Subject: Thanks…but…

Hi,

Thanks for the code, I have tried it out and it is pretty clever the way it works. I have tried a partial update but because my default value of the Problem Type box is not Printers, the page is not even including that field when its being rendered. So when i try to refresh that label, it is not finding it.

I honestly cannot believe i am having this problem,it seems such a simple thing to do - hide a field if another field is equal to x!!!

Really appreciate the help

Jamie

P.S. Is there no way to load all fields when the page loads then do a “PrinterLabel.Visible=False” ??

Subject: It’s probably a simple thing we’re missing here…

do you want to send me (paul_hannan@ie.ibm.com) on your app to help you get by?p.

Subject: Email sent…

Thanks very much for your help!

Hope you get the email ok - you may have to create problem types.

Objective :

When changing the value of Problem Type field, it should refresh and show a table/field asking for Printer Name.

Thanks again.

Jamie

Subject: Thanks!

Paul,

Your code works great!

Cant thank you enough!

Jamie