Unexpected results using $E().update(html)

6 views
Skip to first unread message

CjK

unread,
Jun 11, 2010, 10:07:06 AM6/11/10
to RightJS
Hi,

I do a lot of form-selectbox updating using RightJS. Often, I re-build
select-options using a template and then insert the <options>-html
into the selectbox. So far so good.

Now, when I build an options-list like so:

var options = "
<option selected="selected" value="">-</option>
<option value="00">Value 00</option>
<option value="01">Value 01</option>
<option value="02">Value 02</option>
";

And do something like the following to insert it into my select-input-
control:

$(my-selectbox-id).update(options);

Then the browser (tested in FF 3.6.x) shows the updated selectbox with
the *last* item (here: "Value 02") currently selected. I'd expect that
the '-' entry would be active instead.

Same happens when I try with $(...).clean().insert(options); instead.

Testing with the same options-list using jQuery, the option marked as
"selected" is indeed displayed as active as expected:

jQuery('#' + my-selectbox-id).html(options);

Or am I doing something wrong here?

BTW:
Looking forward to the 1.6.x release, though my most pressing ticket
(#216 - change-events should bubble in IE) is not yet solved. It's
probably a tricky one, since it's a mis-feature of IE, but would be
*very* convenient to have :)

Thanks,
Claus

MadRabbit

unread,
Jun 11, 2010, 10:17:52 AM6/11/10
to RightJS
Hey Claus,

Good timing. I didn't run into this issue myself, but will check it
out on the weekend http://rightjs.lighthouseapp.com/projects/31989-core/tickets/255-selectupdate-and-selected-option

CjK

unread,
Jun 17, 2010, 5:52:19 AM6/17/10
to RightJS
I noticed this is supposingly fixed in the current master branch for
1.6.0. I'll test it with my code as soon as I'm done with a release.
Reply all
Reply to author
Forward
0 new messages