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

f:selectItem: itemValue vs itemLabel #781

Closed
NicolaIsotta opened this issue May 15, 2017 · 2 comments
Closed

f:selectItem: itemValue vs itemLabel #781

NicolaIsotta opened this issue May 15, 2017 · 2 comments
Assignees
Milestone

Comments

@NicolaIsotta
Copy link
Contributor

NicolaIsotta commented May 15, 2017

Consider this xhtml:

<h:selectOneMenu label="h:selectOneMenu">
	<f:selectItem itemValue="item"/>
</h:selectOneMenu>

<b:selectOneMenu label="b:selectOneMenu">
	<f:selectItem itemValue="item"/>
</b:selectOneMenu>

The generated HTML is:

<select name="j_idt4" size="1">	<option value="item">item</option></select>
<div class="form-group bf-warning has-warning" id="j_idt13">
	<label for="j_idt13Inner" class=" control-label">b:selectOneMenu</label>
	<select id="j_idt13Inner" name="j_idt13Inner" class="form-control">
		<option data-label="&amp;nbsp;" value="item">&nbsp;</option>
	</select>
</div>

As you can see, in the bootsfaces select the label of the option is missing; Mojarra instead derives it from they itemValue if itemLabel is not specified by the user (and not the other way round, like Bootsfaces).
The constructors of javax.faces.model.SelectItem confirm the priority of value over the label.

I'm not submitting a PR since this can be considered a breaking change (and PrimeFaces behaves the wrong (?) way too).

@stephanrauh
Copy link
Collaborator

I suggest we implement a two-way derivation. If either the item-label or the item-value is omitted, it's simply derived from the other one. That way, this isn't a breaking change.

Any objections?

@stephanrauh
Copy link
Collaborator

I've implemented the feature.

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

No branches or pull requests

3 participants