Highlighted
New Member.
1995 views

LeanFT - ListBox - dropdown with numbers not selecting correct item with text

Trying to select an item from dropdown which has numbers as items. On providing the item text not selecting the correct item, instead considering it as index for listitems.

Dom structure:

<select data-ctl="[&quot;Dropdown&quot;]" class="cba_main" id="NoOfDependants" name="$PpyWorkPage$pAssessment$pFinancialSituation$pNoOfDependants" validationtype="required" data-change="[[&quot;postValue&quot;,[&quot;:event&quot;]]]" style="width:100%">
<option value="" title="Select how many dependants">Select how many dependants</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option selected="" value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="20+">20+</option>
</select>

Code written for selection:

Attempt1:

<listobject from application model>.Select("10") -> this selects "9" instead of "10"

attempt2:

ListItem item = <listobject from application model>.GetItem("10)

<listobject from application model>.Select(item) -> selects "9" instead of "10"

Providing "20+" selects as expected. 

Tags (2)
0 Likes
3 Replies
Highlighted
Knowledge Partner
Knowledge Partner

It looks like it's using your number as an index to the list, try:

.Select "10"

Mark Smith.

 

 

0 Likes
Highlighted
New Member.

IListBox is not allowing me to provide the item without braces. 

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Hi Bageesh

did you try - obj.Select("10") or obj.Select(10) ?

 

Thanks

Aviad

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.