Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: Release 1.5
-
Fix Version/s: None
-
Component/s: Tag Library
-
Labels:None
-
Environment:n/a
Description
Currently, the stripes:label tag searches its value in the following order when it is rendered.
- resource: {actionFQN}.{name}
- resource: {actionPath}.{name} (deprecated) - resource: {name}
- The body of the label tag
- A warning message telling you to supply a label value somewhere!
I suggest that it should check the body first for efficiency and flexibility.
Consider the following form.
Billing Address:
<ss:label name="billingAddress.state" />: <ss:text name="billingAddress.state" />
Shipping Address:
<ss:label name="shippingAddress.state" />: <ss:text name="shippingAddress.state" />
Although both fields should have the same caption 'State' in the form, I would like to display different name for each field in the validation error message.
e.g.
Billing Address: State is required.
Shipping Address: State is required.
If the body of the tag is searched first when it is rendered, I can write the form as follows.
Billing Address:
<ss:label name="billingAddress.state">State</ss:label>: <ss:text name="billingAddress.state" />
Shipping Address:
<ss:label name="shippingAddress.state">State</ss:label>: <ss:text name="shippingAddress.state" />
And the StripesResources.properties will have entries like below.
billingAddress.state=Billing Address: State
shippingAddress.state=Shipping Address: State
- I assume that this change does not require anything special when the same string can be used for caption and validation error message (i.e. backward compatible).
Attaching a patch with a small hope.
It certainly is a minor issue, but disturbs me too frequently.
The fix should be backward compatible (unless you are writing unused tag body) and there would be some performance gain if you don't need localization.
How does that sound?