#33 — getValueOfFormElement returns text attribute instead of value attribute in some cases
State | Open |
---|---|
Release: | 1.4 |
Area | Client side framework and general |
Issue type | Bug |
Severity | Medium |
Submitted by | Jonathan Ballet |
Submitted on | 2008-11-25 |
Responsible | Balazs Ree |
Target release: |
—
|
Last modified on
2009-01-12
by
Balazs Ree
When submitting a form, getValueOfFormElement return a value for each element of this form.
However, if used with a select box, which selected option has an empty value, getValueOfFormElement returns the text attribute instead of an empty string, which is not what the developer expects.
I made a small patch which contains two tests cases which show this problem. It's attached to this bug report.
I dug a bit into the code of getValueOfFormElement, and it's seems the bug is triggered by a hack for IE compatibility (from kukit/forms.js)::
{
var option = element.options[element.selectedIndex];
// on FF and safari, option.value has the value
// on IE, option.text needs to be used
value = option.value || option.text;
}
I made the patch from a current (r60130) Subversion checkout.
However, if used with a select box, which selected option has an empty value, getValueOfFormElement returns the text attribute instead of an empty string, which is not what the developer expects.
I made a small patch which contains two tests cases which show this problem. It's attached to this bug report.
I dug a bit into the code of getValueOfFormElement, and it's seems the bug is triggered by a hack for IE compatibility (from kukit/forms.js)::
{
var option = element.options[element.selectedIndex];
// on FF and safari, option.value has the value
// on IE, option.text needs to be used
value = option.value || option.text;
}
I made the patch from a current (r60130) Subversion checkout.
Added by
Luciano Pacheco
on
2009-01-12 22:02
First:
These is duplicated from http://kssproject.org/bugs/30
Second:
I have the same problem.
I can confirm that the problem is these hack for IE, I change the line
value = option.value || option.text; to:
value = option.value
And then becames work here, I'm using FF.
On kukit/dom.js, has a function getAttribute, can it be a solution to these problem ?
I don't know how can use kukit/dom.js within form.js, then I can't test these idea.
Thanks,
These is duplicated from http://kssproject.org/bugs/30
Second:
I have the same problem.
I can confirm that the problem is these hack for IE, I change the line
value = option.value || option.text; to:
value = option.value
And then becames work here, I'm using FF.
On kukit/dom.js, has a function getAttribute, can it be a solution to these problem ?
I don't know how can use kukit/dom.js within form.js, then I can't test these idea.
Thanks,
Added by
Balazs Ree
on
2009-01-13 00:43
Issue state:
unconfirmed → open
Responsible manager:
(UNASSIGNED) → ree
Thanks for reporting! I will look at this asap.