You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Adam Zimowski (JIRA)" <de...@tapestry.apache.org> on 2008/02/04 12:41:07 UTC

[jira] Created: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
------------------------------------------------------------------------------------------------------------------------

                 Key: TAPESTRY-2119
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
             Project: Tapestry
          Issue Type: New Feature
          Components: Core Components
    Affects Versions: 5.0.9
            Reporter: Adam Zimowski
             Fix For: 5.0.10


There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.

Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.

This component takes two arguments, a literal string denoting field
for which error should be rendered, and form to which field is bound.
The form must be accessible via getter from the page class.

import org.apache.tapestry.Field;
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.ValidationTracker;
import org.apache.tapestry.annotations.BeginRender;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.corelib.components.Form;

public class ErrorMsg {

       @Parameter
       private String _fieldName;

       @Parameter
       private Form _form;


       public void setFieldName(String aFieldName) {
               _fieldName = aFieldName;
       }

       @BeginRender
   void renderMessage(MarkupWriter writer)
   {
               Field f = new Field() {
                       public String getElementName() { return _fieldName; }
                       public String getLabel() { return null; }
                       public boolean isDisabled() { return false; }
                       public String getClientId() { return _fieldName; }
               };

               ValidationTracker tracker = _form.getDefaultTracker();
               String err = tracker.getError(f);

               writer.write(err);
   }

       public void setForm(Form aForm) {
               _form = aForm;
       }

      /* also foo/bar setters here */
}

To display individual error messages simply place <t:errorMsg ../>
anywhere on the page. It will render the error if there is one for a
field.

<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>

<t:form t:id="myform">
User Name:
       <input type="text" t:type="textfield" t:id="bar" t:value="bar"
t:validate="required,minlength=3,maxlength=8"/><br/>
Foo:
       <input type="text" t:type="textfield" t:id="foo" t:value="foo"
t:validate="required"/>
       <p/>
       <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
       <p/>
       <t:errorMsg fieldName="literal:bar" form="form"/><br/>
       <!-- you can even display same error twice :) -->
       <t:errorMsg fieldName="literal:bar" form="form"/>
</t:form>

</t:layout>


Page Class:

public class Start {

       @Persist
       private String _foo;

       @Persist
       private String _bar;

       @Component(id="myform")
       private Form _form;

       public Form getForm() {
               return _form;
       }

       public String getBar() {
               return _bar;
       }

       public String getFoo() {
               return _foo;
       }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Sinan Saral (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589552#action_12589552 ] 

Sinan Saral commented on TAPESTRY-2119:
---------------------------------------

I guess; you can also write it without the explicit reference to Form component:

public class ErrorMsg {
	@Parameter(required = true, defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
	private String _fieldName;

	@Environmental(false)
	private ValidationTracker _tracker;

	public void setFieldName(String aFieldName) {
		_fieldName = aFieldName;
	}

	void beginRender(MarkupWriter writer) {
		if (_tracker == null)
			throw new RuntimeException(InternalMessages.encloseErrorsInForm());

		Field f = new Field() {
			public String getLabel() {
				return null;
			}

			public boolean isDisabled() {
				return false;
			}

			public String getClientId() {
				return _fieldName;
			}

			public String getControlName() {
				return _fieldName;
			}

			public boolean isRequired() {
				return false;
			}
		};
		String err = _tracker.getError(f);
		writer.write(err);
	}
}


> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2119
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Core Components
>    Affects Versions: 5.0.9
>            Reporter: Adam Zimowski
>            Priority: Minor
>             Fix For: 5.1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Adam Zimowski (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Zimowski updated TAPESTRY-2119:
------------------------------------

       Priority: Minor  (was: Major)
    Description: 
There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.

Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.

This component takes two arguments, a literal string denoting field
for which error should be rendered, and form to which field is bound.
The form must be accessible via getter from the page class.

import org.apache.tapestry.Field;
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.ValidationTracker;
import org.apache.tapestry.annotations.BeginRender;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.corelib.components.Form;

public class ErrorMsg {

       @Parameter
       private String _fieldName;

       @Parameter
       private Form _form;


       public void setFieldName(String aFieldName) {
               _fieldName = aFieldName;
       }

       @BeginRender
   void renderMessage(MarkupWriter writer)
   {
               Field f = new Field() {
                       public String getElementName() { return _fieldName; }
                       public String getLabel() { return null; }
                       public boolean isDisabled() { return false; }
                       public String getClientId() { return _fieldName; }
               };

               ValidationTracker tracker = _form.getDefaultTracker();
               String err = tracker.getError(f);

               writer.write(err);
   }

       public void setForm(Form aForm) {
               _form = aForm;
       }
}

To display individual error messages simply place <t:errorMsg ../>
anywhere on the page. It will render the error if there is one for a
field.

<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>

<t:form t:id="myform">
User Name:
       <input type="text" t:type="textfield" t:id="bar" t:value="bar"
t:validate="required,minlength=3,maxlength=8"/><br/>
Foo:
       <input type="text" t:type="textfield" t:id="foo" t:value="foo"
t:validate="required"/>
       <p/>
       <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
       <p/>
       <t:errorMsg fieldName="literal:bar" form="form"/><br/>
       <!-- you can even display same error twice :) -->
       <t:errorMsg fieldName="literal:bar" form="form"/>
</t:form>

</t:layout>


Page Class:

public class Start {

       @Persist
       private String _foo;

       @Persist
       private String _bar;

       @Component(id="myform")
       private Form _form;

       public Form getForm() {
               return _form;
       }

       public String getBar() {
               return _bar;
       }

       public String getFoo() {
               return _foo;
       }


      /* also foo/bar setters here */
}

  was:
There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.

Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.

This component takes two arguments, a literal string denoting field
for which error should be rendered, and form to which field is bound.
The form must be accessible via getter from the page class.

import org.apache.tapestry.Field;
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.ValidationTracker;
import org.apache.tapestry.annotations.BeginRender;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.corelib.components.Form;

public class ErrorMsg {

       @Parameter
       private String _fieldName;

       @Parameter
       private Form _form;


       public void setFieldName(String aFieldName) {
               _fieldName = aFieldName;
       }

       @BeginRender
   void renderMessage(MarkupWriter writer)
   {
               Field f = new Field() {
                       public String getElementName() { return _fieldName; }
                       public String getLabel() { return null; }
                       public boolean isDisabled() { return false; }
                       public String getClientId() { return _fieldName; }
               };

               ValidationTracker tracker = _form.getDefaultTracker();
               String err = tracker.getError(f);

               writer.write(err);
   }

       public void setForm(Form aForm) {
               _form = aForm;
       }

      /* also foo/bar setters here */
}

To display individual error messages simply place <t:errorMsg ../>
anywhere on the page. It will render the error if there is one for a
field.

<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>

<t:form t:id="myform">
User Name:
       <input type="text" t:type="textfield" t:id="bar" t:value="bar"
t:validate="required,minlength=3,maxlength=8"/><br/>
Foo:
       <input type="text" t:type="textfield" t:id="foo" t:value="foo"
t:validate="required"/>
       <p/>
       <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
       <p/>
       <t:errorMsg fieldName="literal:bar" form="form"/><br/>
       <!-- you can even display same error twice :) -->
       <t:errorMsg fieldName="literal:bar" form="form"/>
</t:form>

</t:layout>


Page Class:

public class Start {

       @Persist
       private String _foo;

       @Persist
       private String _bar;

       @Component(id="myform")
       private Form _form;

       public Form getForm() {
               return _form;
       }

       public String getBar() {
               return _bar;
       }

       public String getFoo() {
               return _foo;
       }
}


> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2119
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Core Components
>    Affects Versions: 5.0.9
>            Reporter: Adam Zimowski
>            Priority: Minor
>             Fix For: 5.0.10
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Issue Comment Edited: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Sinan Saral (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589552#action_12589552 ] 

sinan edited comment on TAPESTRY-2119 at 4/17/08 12:01 AM:
-----------------------------------------------------------------

I guess; you can also write it without the explicit reference to Form component:

public class ErrorMsg {
    @Parameter(name = "for", required = true, defaultPrefix = "component")
    private Field _field;

    @Environmental
    private ValidationTracker _tracker;

    void beginRender(MarkupWriter writer) {
        if (_tracker == null)  throw new RuntimeException( InternalMessages.encloseErrorsInForm() );

        String err = _tracker.getError(_field);
        writer.write(err);
    }
}

then you can use it like:

<t:errorMsg for="username" />


      was (Author: sinan):
    I guess; you can also write it without the explicit reference to Form component:

public class ErrorMsg {
    @Parameter(required = true, defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
    private String _fieldName;

    @Environmental
    private ValidationTracker _tracker;

    public void setFieldName(String aFieldName) {
        _fieldName = aFieldName;
    }

    void beginRender(MarkupWriter writer) {
        if (_tracker == null) throw new RuntimeException(InternalMessages.encloseErrorsInForm());
        Field f = new Field() {
                           public String getLabel() {  return null;  }
                           public boolean isDisabled() {  return false;  }
                           public String getClientId() {  return _fieldName;  }
                           public String getControlName() {  return _fieldName;  }
                           public boolean isRequired() {  return false;  }
                 };
         String err = _tracker.getError(f);
         writer.write(err);
    }
}

then you can use it like:

<t:errorMsg fieldName="username" />

  
> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2119
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Core Components
>    Affects Versions: 5.0.9
>            Reporter: Adam Zimowski
>            Priority: Minor
>             Fix For: 5.1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAP5-52) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-52?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAP5-52:
-------------------------------------

    Issue Type: New Feature  (was: Bug)

> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-52
>                 URL: https://issues.apache.org/jira/browse/TAP5-52
>             Project: Tapestry 5
>          Issue Type: New Feature
>    Affects Versions: 5.0.15
>            Reporter: Adam Zimowski
>            Priority: Minor
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Issue Comment Edited: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Sinan Saral (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589552#action_12589552 ] 

sinan edited comment on TAPESTRY-2119 at 4/16/08 6:40 AM:
----------------------------------------------------------------

I guess; you can also write it without the explicit reference to Form component:

public class ErrorMsg {
    @Parameter(required = true, defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
    private String _fieldName;

    @Environmental
    private ValidationTracker _tracker;

    public void setFieldName(String aFieldName) {
        _fieldName = aFieldName;
    }

    void beginRender(MarkupWriter writer) {
        if (_tracker == null) throw new RuntimeException(InternalMessages.encloseErrorsInForm());
        Field f = new Field() {
                           public String getLabel() {  return null;  }
                           public boolean isDisabled() {  return false;  }
                           public String getClientId() {  return _fieldName;  }
                           public String getControlName() {  return _fieldName;  }
                           public boolean isRequired() {  return false;  }
                 };
         String err = _tracker.getError(f);
         writer.write(err);
    }
}

then you can use it like:

<t:errorMsg fieldName="username" />


      was (Author: sinan):
    I guess; you can also write it without the explicit reference to Form component:

public class ErrorMsg {
    @Parameter(required = true, defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
    private String _fieldName;

    @Environmental(false)
    private ValidationTracker _tracker;

    public void setFieldName(String aFieldName) {
        _fieldName = aFieldName;
    }

    void beginRender(MarkupWriter writer) {
        if (_tracker == null) throw new RuntimeException(InternalMessages.encloseErrorsInForm());
        Field f = new Field() {
                           public String getLabel() {  return null;  }
                           public boolean isDisabled() {  return false;  }
                           public String getClientId() {  return _fieldName;  }
                           public String getControlName() {  return _fieldName;  }
                           public boolean isRequired() {  return false;  }
                 };
         String err = _tracker.getError(f);
         writer.write(err);
    }
}

then you can use it like:

<t:errorMsg fieldName="username" />

  
> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2119
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Core Components
>    Affects Versions: 5.0.9
>            Reporter: Adam Zimowski
>            Priority: Minor
>             Fix For: 5.1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAPESTRY-2119:
-------------------------------------------

    Fix Version/s:     (was: 5.0.11)
                   5.1

> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2119
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Core Components
>    Affects Versions: 5.0.9
>            Reporter: Adam Zimowski
>            Priority: Minor
>             Fix For: 5.1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAPESTRY-2119:
-------------------------------------------

    Fix Version/s:     (was: 5.0.10)
                   5.0.11

> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2119
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Core Components
>    Affects Versions: 5.0.9
>            Reporter: Adam Zimowski
>            Priority: Minor
>             Fix For: 5.0.11
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Issue Comment Edited: (TAPESTRY-2119) A new tag should compliment existing so that individual form error messages can be customized.

Posted by "Sinan Saral (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589552#action_12589552 ] 

sinan edited comment on TAPESTRY-2119 at 4/16/08 6:33 AM:
----------------------------------------------------------------

I guess; you can also write it without the explicit reference to Form component:

public class ErrorMsg {
    @Parameter(required = true, defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
    private String _fieldName;

    @Environmental(false)
    private ValidationTracker _tracker;

    public void setFieldName(String aFieldName) {
        _fieldName = aFieldName;
    }

    void beginRender(MarkupWriter writer) {
        if (_tracker == null) throw new RuntimeException(InternalMessages.encloseErrorsInForm());
        Field f = new Field() {
                           public String getLabel() {  return null;  }
                           public boolean isDisabled() {  return false;  }
                           public String getClientId() {  return _fieldName;  }
                           public String getControlName() {  return _fieldName;  }
                           public boolean isRequired() {  return false;  }
                 };
         String err = _tracker.getError(f);
         writer.write(err);
    }
}

then you can use it like:

<t:errorMsg fieldName="username" />


      was (Author: sinan):
    I guess; you can also write it without the explicit reference to Form component:

public class ErrorMsg {
	@Parameter(required = true, defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX)
	private String _fieldName;

	@Environmental(false)
	private ValidationTracker _tracker;

	public void setFieldName(String aFieldName) {
		_fieldName = aFieldName;
	}

	void beginRender(MarkupWriter writer) {
		if (_tracker == null)
			throw new RuntimeException(InternalMessages.encloseErrorsInForm());

		Field f = new Field() {
			public String getLabel() {
				return null;
			}

			public boolean isDisabled() {
				return false;
			}

			public String getClientId() {
				return _fieldName;
			}

			public String getControlName() {
				return _fieldName;
			}

			public boolean isRequired() {
				return false;
			}
		};
		String err = _tracker.getError(f);
		writer.write(err);
	}
}

  
> A new <t:error ../> tag should compliment existing <t:errors/> so that individual form error messages can be customized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2119
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2119
>             Project: Tapestry
>          Issue Type: New Feature
>          Components: Core Components
>    Affects Versions: 5.0.9
>            Reporter: Adam Zimowski
>            Priority: Minor
>             Fix For: 5.1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> There shold be an easy way to use "normal text" as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Tapestry provides <t:errors/> core component to display all form errors at once, but there is currently no easy way to control individual error messages. Following current design, an "intuitive" way for end user would be to look for <t:error/> tag but there is no such tag.
> Here is a draft of a proposed solution. The <t:errorMsg/> tag allows to control individual form error messages and can be placed inside or outside of a form effectively allowing end user to place form error anywhere on a page as plain text. This code should probably be enhanced to also allow control of individual fields: yes/no red X for icon next to a field, yes/no for automatic styling of field on error, etc.
> This component takes two arguments, a literal string denoting field
> for which error should be rendered, and form to which field is bound.
> The form must be accessible via getter from the page class.
> import org.apache.tapestry.Field;
> import org.apache.tapestry.MarkupWriter;
> import org.apache.tapestry.ValidationTracker;
> import org.apache.tapestry.annotations.BeginRender;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.corelib.components.Form;
> public class ErrorMsg {
>        @Parameter
>        private String _fieldName;
>        @Parameter
>        private Form _form;
>        public void setFieldName(String aFieldName) {
>                _fieldName = aFieldName;
>        }
>        @BeginRender
>    void renderMessage(MarkupWriter writer)
>    {
>                Field f = new Field() {
>                        public String getElementName() { return _fieldName; }
>                        public String getLabel() { return null; }
>                        public boolean isDisabled() { return false; }
>                        public String getClientId() { return _fieldName; }
>                };
>                ValidationTracker tracker = _form.getDefaultTracker();
>                String err = tracker.getError(f);
>                writer.write(err);
>    }
>        public void setForm(Form aForm) {
>                _form = aForm;
>        }
> }
> To display individual error messages simply place <t:errorMsg ../>
> anywhere on the page. It will render the error if there is one for a
> field.
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <strong><t:errorMsg fieldName="literal:foo" form="form"/></strong>
> <t:form t:id="myform">
> User Name:
>        <input type="text" t:type="textfield" t:id="bar" t:value="bar"
> t:validate="required,minlength=3,maxlength=8"/><br/>
> Foo:
>        <input type="text" t:type="textfield" t:id="foo" t:value="foo"
> t:validate="required"/>
>        <p/>
>        <input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
>        <p/>
>        <t:errorMsg fieldName="literal:bar" form="form"/><br/>
>        <!-- you can even display same error twice :) -->
>        <t:errorMsg fieldName="literal:bar" form="form"/>
> </t:form>
> </t:layout>
> Page Class:
> public class Start {
>        @Persist
>        private String _foo;
>        @Persist
>        private String _bar;
>        @Component(id="myform")
>        private Form _form;
>        public Form getForm() {
>                return _form;
>        }
>        public String getBar() {
>                return _bar;
>        }
>        public String getFoo() {
>                return _foo;
>        }
>       /* also foo/bar setters here */
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org