« Return to Thread: [ANN] Simplified form validation in 1.238

[ANN] Simplified form validation in 1.238

by kohsuke :: Rate this Message:

Reply to Author | View in Thread


I just committed a change in 1.238 to make the form validation easier.

Before this change, it was necessary to write 3 attributes when you are
defining form field tags like <f:textbox/>. The following example is
taken from
http://hudson.gotdns.com/wiki/display/HUDSON/SCM+plugin+architecture

>         <f:textbox name="tfs.project" value="${scm.project}"
>              checkUrl="'/fieldCheck?errorText='+escape('${%Project is mandatory.}')+'&value='+escape(this.value)"/>

   ...

>         <f:entry title="Workspace name" help="/plugin/tfs/workspacename.html">
>             <f:textbox name="tfs.workspaceName" value="${scm.workspaceName}"/>


With this change, you'll only need to write:

   <f:textbox field="project" />

   <f:textbox field="workspaceName" />

The tag will check if your Descriptor has the "doCheckProject" method
and "doCheckWorkspaceName" and if so, it automatically wire up the field
for the form field validation.

In this way, you can simplify the jelly programming part by relying more
on the convention, and hopefully this would encourage people to write
more form-field validation code.

This support is currently implemented for <f:textbox> and
<f:editableComboBox/>. I'll update the core to use this new feature and
expand the support to other tags. Plugin authors, please be encouraged
to use this new feature, because when people develop new plugins, they
look at your code and copy things from there.

My ultimate goal is to implement the auto-generation of the form, so
that in simple cases you don't have to write any Jelly code at all.

--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/


smime.p7s (4K) Download Attachment

 « Return to Thread: [ANN] Simplified form validation in 1.238

LightInTheBox - Buy quality products at wholesale price!