Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Specify "multiple" html attribute on WhMultiSelect #32

Closed
velosipedist opened this issue Jul 20, 2013 · 4 comments
Closed

Specify "multiple" html attribute on WhMultiSelect #32

velosipedist opened this issue Jul 20, 2013 · 4 comments

Comments

@velosipedist
Copy link

Without passing 'multiple'=>'multiple' in widget's htmlOptions multiselected values in hidden dropdown input will be restored from model incorrectly, at least in Chrome v28 for Windows.

For now, it can be only workarounded like:

$this->widget('yiiwheels.widgets.multiselect.WhMultiSelect',array(
    // rest of config options - model, attribute, etc
    'htmlOptions'=>array('multiple'=>'multiple')
));
@tonydspaniard
Copy link
Member

Thanks! Should we add that by default?

@velosipedist
Copy link
Author

It was expected from widget to behave as always multiple selector. Therefore, it have to be hardcoded in widget, like

public function renderField()
    {
        list($name, $id) = $this->resolveNameID();

        $this->htmlOptions = TbHtml::defaultOption('id', $id, $this->htmlOptions);
        $this->htmlOptions = TbHtml::defaultOption('name', $name, $this->htmlOptions);
        // it will be forced later in jQuery plugin anyway, but Chrome will be treat it wrong
        $this->htmlOptions['multiple'] = 'multiple';

        //...render
    }

@tonydspaniard
Copy link
Member

any chance for a pull request @velosipedist ?

@velosipedist
Copy link
Author

I'll try at this week. Have no much expereience of pull-requesting.

tonydspaniard pushed a commit that referenced this issue Jul 26, 2013
tonydspaniard added a commit that referenced this issue Aug 4, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants