This is an automated notification sent by LCG Savannah.
It relates to:
                task #11217, project CDS Invenio

==============================================================================
 OVERVIEW of task #11217:
==============================================================================

URL:
  <http://savannah.cern.ch/task/?11217>

                 Summary: Checking value of mandatory lists (select/option
items)
                 Project: CDS Invenio
            Submitted by: jcaffaro
            Submitted on: 2009-09-14 13:40
         Should Start On: 2009-09-14 00:00
   Should be Finished on: 2009-09-14 00:00
                Category: WebSubmit
                Priority: 7 - High
                  Status: None
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                  Effort: 0.00

    _______________________________________________________


When submitting a form and checking if all mandatory lists have a selected
value, WebSubmit looks at the document.forms[0].elements['MY_ELEMENT'].value
to make sure it is not empty. This gives different results depending on the
browser when the "value" attribute of the option tag is not set. For eg. the
document.forms[0].elements['MY_ELEMENT'].value of the following list is "1"
on Firefox, "" (empty string) on Internet Explorer:

<select>
    <option selected="selected">1</option>
    <option>2</option>
</select>

(resulting in the form not being submitted with Internet Explorer)

while it would be "1" with both browsers with the following code:

<select>
    <option selected="selected" value="1">1</option>
    <option value="2">2</option>
</select>


In all cases, the submitted value would be 1 (when value is not set, the
submitted value is the "label" of the option).

WebSubmit should be fixed to have a coherent behaviour.
Alternative ways of checking are available, such as:

el.options[el.selectedIndex].value; /*Get selected value*/
el.options[el.selectedIndex].text; /*Get selected label*/


Mandatory lists seem to make no sense, since an option is ALWAYS selected.
However one should consider that <select multiple="multiple"> tags allow
selection of no value, AND that some code might rely on the fact the option
without a value mean no selection, for eg. in this case:

<select>
    <option selected="selected">Please select an option:</option>
    <option value="1">1</option>
    <option value="2">2</option>
</select>

(which would now work only in IE btw)



    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
2407                                | -SUB-




==============================================================================

This item URL is:
  <http://savannah.cern.ch/task/?11217>

_______________________________________________
  Message sent via/by LCG Savannah
  http://savannah.cern.ch/

Reply via email to