Skip to content

Conversation

@spiegela
Copy link

The title (and commit message) kind of speak for themselves. I have some multi-select boxes, and without this patch, the "_text" attribute is pretty useless.

For example, with the view:

      <select id='multiple_select' multiple='true'>
        <option value='selection_1'>Selection 1</option>
        <option value='selection_2'>Selection 2</option>
      </select>

with both of these selected you'll have an attribute like:

model.multiple_select
 -> ["selection_1", "selection_2"]
model.multiple_select_text
 -> "Selection 1Selection 2"

With my patch, things will work more appropriately:

model.multiple_select
 -> ["selection_1", "selection_2"]
model.multiple_select_text
 -> ["Selection 1", "Selection 2"]

Hooray!

Specs are included, let me know what you think!

@paulyoder
Copy link
Collaborator

@spiegela there's another pull request that we're getting ready pull in, and it is going to get rid of the _text attribute for select boxes. We didn't really see a need for them.

Can you explain how you use the _text attribute in your app and why it's a benefit. We'll keep the _text attribute if people are using it.

@spiegela
Copy link
Author

The _text attributes make things convenient for me. In my app, I have a set of views that create a back-end query. It also sets up other views for displaying that query. I am planning to use the "value" of the select box for the query, and the "_text" attribute for views, with the human-readable version.

Of course, without this feature, there are other ways to do this -- like make the selection value be an index of a collection, but this way is nice and easy.

Thanks!

@mxriverlynn
Copy link
Owner

still not sure what we should do with this...

can you explain your scenario a little further, @spiegela? I'm not sure i understand why you need the _text value.

I know when I originally wrote the code that uses _text, it was because I wasn't using Backbone correctly. I was using it to pull values from the select box and populate my model before sending it back to the server. What I should have done, was send all of the data back to the server and have the server respond with a _text version of the value, instead of relying on the client side code to track that.

Is there a way for you to do something like this, or is it really going to be that much easier for you to have a _text attribute for your select boxes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants