tags:

views:

101

answers:

3

for multiple selectdown form, how can you express multiple options selected ?

  <select name="sweets" multiple="multiple">
    <option>Chocolate</option>
    <option selected="selected">Candy</option>
    <option>Taffy</option>
    <option selected="selected">Caramel</option>
    <option>Fudge</option>
    <option>Cookie</option>
  </select>

/html/body/form/select/option[1],option[2],option[3] ?

+1  A: 

maybe rather like "/html/body/form/select/option[@selected='selected']"

flq
actually i should've been more clear. i dont just want the selected options. i want the other options as well.what i want is a way to select multiple options. /html/body/form/select/option[@val = '1'],option[@val = '3']
oiyto
+1  A: 

try this:

/html/body/form/select/option[1] | /html/body/form/select/option[2]

The pipe character ("|") join two sets, removing duplicate ones

Rubens Farias
+1  A: 

Not tested, but wouldn't this be:

/html/body/form/select/option[@selected='selected']

Update: Based on your comment, would you not need something like:

/html/body/form/select/option[@val = '1' or @val = '3']

(though your example select doesn't have any val attributes)

toolkit
actually i should've been more clear. i dont just want the selected options. i want the other options as well.what i want is a way to select multiple options. /html/body/form/select/option[@val = '1'],option[@val = '3']
oiyto