Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Do not show "Please select one of the following..." #87

Closed
Martinomagnifico opened this issue Mar 19, 2013 · 5 comments

Comments

@Martinomagnifico
Copy link

Is it possible to NOT show the "Please select one of the following..." item? I usually have that one as the first item, with an empty value, so that jqBootstrapValidation will mark it as invalid if no other value is selected.

However, that item is now shown in both the dropdown AND the first item in the openend div. It should be only in the dropdown.

For usability's sake, I understand that the "empty" item could be reselected if someone doesn't know what to select, but that would be covered by adding a last item "None of the above".

Also, I've needed to add CSS as .control-group.error .dropdown-toggle to be the same as .control-group.error select, is there a way for this to happen automatically? This is also for the validation: in my CSS, I make the outline red if no value is in the select at submit.

@Martinomagnifico
Copy link
Author

I fixed it like this:

    $("li:last-child,td:last-child,tr:last-child,dt:last-child").addClass("last");
    $("li:first-child,td:first-child,tr:first-child,dt:first-child").addClass("first"); 

and

    .bootstrap-select .first {display:none}

So no need for pseudo :first.

@mattbryson
Copy link
Contributor

In the latest version you can set the 'title' attribute of a multi select and it will show a prompt that does not appear in the list.

Currently you cannot do this to a standard select, as the standard select requires a selected value.

@Martinomagnifico
Copy link
Author

Thanks. Then I'll stick to my solution.

@caseyjhol
Copy link
Member

You can now add the data-hidden="true" attribute to the first option.

<select class="selectpicker" title="Please Select...">
    <option data-hidden="true"></option>
    <option>Mustard</option>
    <option>Ketchup</option>
    <option>Relish</option>
    <option>Onions</option>
</select>

@Martinomagnifico
Copy link
Author

Thanks! This gets ugly however if the plugin is disabled on the page...

Martijn

Op 30 apr. 2013 om 00:42 heeft caseyjhol notifications@github.com het volgende geschreven:

You can now add the data-hidden="true" attribute to the first option.

Mustard Ketchup Relish Onions — Reply to this email directly or view it on GitHub.

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

No branches or pull requests

4 participants