You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/07/21 15:08:09 UTC
[jira] Resolved: (TAPESTRY-205) Change AbstractTextField to handle disabled fields better
[ http://issues.apache.org/jira/browse/TAPESTRY-205?page=all ]
Howard M. Lewis Ship resolved TAPESTRY-205:
-------------------------------------------
Resolution: Won't Fix
Assign To: (was: Tapestry Developer List)
This can be accomplished using a Hidden component.
> Change AbstractTextField to handle disabled fields better
> ---------------------------------------------------------
>
> Key: TAPESTRY-205
> URL: http://issues.apache.org/jira/browse/TAPESTRY-205
> Project: Tapestry
> Type: Bug
> Components: Framework
> Versions: 3.0
> Environment: Operating System: Other
> Platform: Other
> Reporter: Eric Glass
>
> I was wondering if a change I made to handle disable fields better could be an
> enhancement for the future for everyone.
> I found it helpful that if a field was disabled to generate the field with a
> special name and also generate a hidden field with the correct name and value,
> so that when the form is submitted the value for the field is not lost.
> Here is the code I used in the renderComponent method:
> String value;
> IForm form = getForm(cycle);
> // It isn't enough to know whether the cycle in general is rewinding,
> need to know
> // specifically if the form which contains this component is rewinding.
> boolean rewinding = form.isRewinding();
> // If the cycle is rewinding, but the form containing this field is not,
> // then there's no point in doing more work.
> if (!rewinding && cycle.isRewinding())
> return;
> // Used whether rewinding or not.
> String name = form.getElementId(this);
>
> if (rewinding)
> {
> // EG - 08/12/2004 if (!isDisabled())
> // EG - 08/12/2004 {
> value = cycle.getRequestContext().getParameter(name);
>
> // EG - 08/12/2004 Start Add
> if (value != null)
> {
> // EG - 08/12/2004 End Add
> updateValue(value);
> }
> return;
> }
> writer.beginEmpty("input");
> writer.attribute("type", isHidden() ? "password" : "text");
> if (isDisabled())
> // EG - 08/12/2004 Start Add
> {
> // EG - 08/12/2004 End Add
> writer.attribute("disabled", "disabled");
> // EG - 08/12/2004 Start Add
> writer.attribute("name", name + "$Disabled");
> }
> else
> {
> // EG - 08/12/2004 End Add
> writer.attribute("name", name);
> // EG - 08/12/2004 Start Add
> }
> // EG - 08/12/2004 End Add
> value = readValue();
> if (value != null)
> writer.attribute("value", value);
> renderInformalParameters(writer, cycle);
> beforeCloseTag(writer, cycle);
> writer.closeTag();
> // EG - 08/12/2004 Start Add
> if (isDisabled())
> {
> if (value != null)
> {
> form.addHiddenValue(name, value);
> }
> else
> {
> form.addHiddenValue(name, "");
> }
> }
> // EG - 08/12/2004 End Add
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org