0

I'm trying to make a pop up selector using the Dialog control. My idea is to have a list box with a list and upon selection it should set a sessionScope and close. On the pc i have finished it and it works perfectly. On the ipad i get an empty dialog.

Im thinking its some of the reoccurring issues with IOS and datasources? Anyway here is my code:

<unp:unpDialog callback="SetCoolList" title="List of Choices">
<xp:this.facets>
<xp:panel xp:key="facet_1">


<xp:listBox id="listBox1" styleClass="mychooser">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:sessionScope.bitsnbobs;}]]></xp:this.value>
</xp:selectItems>

<xp:this.attrs>
<xp:attr name="onchange">
<xp:this.value><![CDATA[#{javascript:
      return "$('.OptionsButton').click();"; 
}]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
</xp:listBox>

<xp:button id="OptionsButton" styleClass="OptionsButton hidden">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" immediate="true">
<xp:this.action>
<xp:actionGroup>

<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:sessionScope.coollistwa = getComponent("listBox1").getValue();
}]]></xp:this.script>
</xp:executeScript>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>


</xp:panel>
</xp:this.facets>
</unp:unpDialog>

Is there a workaround for providing a collection of strings to the listbox that works with a dialog control and on the ios?

1 Answers1

1

I tested your code using the Unplugged Controls 3.3 database and you're right in seeing a different behaviour in a desktop browser vs iOS: in the desktop browser you'll get a <select> control that shows multiple entries at once, on iOS you'll see a blank box. Tapping on that blank box brings up the standard iOS value picker. The only issue I see is that the blank box looks strange in the dialog.

This doesn't seem to me like an Unplugged issue, but rather the result of the way these controls are rendered in different browsers. See also this thread for some background. There are some workarounds discussed there.

If you want to display a list of choices you can also use an <xp:repeat> control in the dialog that shows the text of each entry and attach an onclick handler to each entry like you did in your code to the options of the <xp:listBox>.

Community
  • 1
  • 1
Mark Leusink
  • 3,747
  • 15
  • 23