You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Johan Gorter (JIRA)" <de...@myfaces.apache.org> on 2006/04/03 09:44:43 UTC
[jira] Created: (TOMAHAWK-227) Possibility to select nothing
Possibility to select nothing
-----------------------------
Key: TOMAHAWK-227
URL: http://issues.apache.org/jira/browse/TOMAHAWK-227
Project: MyFaces Tomahawk
Type: Improvement
Components: selectOneRadio / radio
Reporter: Johan Gorter
The UISelectOne descendants, especially the HtmlSelectOneMenu is missing a powerful option. They cannot be used to select nothing/null.
I am using the selectCountry component to select an optional nationality of a person. This field is not required, so it should be able to display the empty option, resolving to null instead of a country code. I am using my own descendant of SelectOneCountry as displayed below. I think however that all users of tomahawk components would greatly benefit if the empty option can be turned on in a super component, like UISelectOne. This is also very useful with required="true". The user is then forced to select something, otherwise a validation error occurs.
Hope you agree with this usefullness.
Regards,
Johan Gorter
public class SelectOneOrNoCountry extends SelectOneCountry {
private static final String NULL_MASK="@@NULL@@";
private static SelectItem NOCOUNTRY=new SelectItem();
static {
NOCOUNTRY.setLabel(" - ");
NOCOUNTRY.setValue(NULL_MASK);
}
protected List getCountriesChoicesAsSelectItemList() {
List result = super.getCountriesChoicesAsSelectItemList();
result.add(0, NOCOUNTRY);
return result;
}
protected Object getConvertedValue(FacesContext context, Object submittedValue) {
if (NULL_MASK.equals(submittedValue)) {
return null;
}
return super.getConvertedValue(context, submittedValue);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Resolved: (TOMAHAWK-227) Possibility to select nothing
Posted by "Johan Gorter (JIRA)" <de...@myfaces.apache.org>.
[ http://issues.apache.org/jira/browse/TOMAHAWK-227?page=all ]
Johan Gorter resolved TOMAHAWK-227:
-----------------------------------
Resolution: Duplicate
http://issues.apache.org/jira/browse/TOMAHAWK-23
> Possibility to select nothing
> -----------------------------
>
> Key: TOMAHAWK-227
> URL: http://issues.apache.org/jira/browse/TOMAHAWK-227
> Project: MyFaces Tomahawk
> Type: Improvement
> Components: selectOneRadio / radio
> Reporter: Johan Gorter
>
> The UISelectOne descendants, especially the HtmlSelectOneMenu is missing a powerful option. They cannot be used to select nothing/null.
> I am using the selectCountry component to select an optional nationality of a person. This field is not required, so it should be able to display the empty option, resolving to null instead of a country code. I am using my own descendant of SelectOneCountry as displayed below. I think however that all users of tomahawk components would greatly benefit if the empty option can be turned on in a super component, like UISelectOne. This is also very useful with required="true". The user is then forced to select something, otherwise a validation error occurs.
> Hope you agree with this usefullness.
> Regards,
> Johan Gorter
> public class SelectOneOrNoCountry extends SelectOneCountry {
>
> private static final String NULL_MASK="@@NULL@@";
>
> private static SelectItem NOCOUNTRY=new SelectItem();
> static {
> NOCOUNTRY.setLabel(" - ");
> NOCOUNTRY.setValue(NULL_MASK);
> }
>
> protected List getCountriesChoicesAsSelectItemList() {
> List result = super.getCountriesChoicesAsSelectItemList();
> result.add(0, NOCOUNTRY);
> return result;
> }
>
> protected Object getConvertedValue(FacesContext context, Object submittedValue) {
> if (NULL_MASK.equals(submittedValue)) {
> return null;
> }
> return super.getConvertedValue(context, submittedValue);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira