Geert, does ths example compile? I know addConstraint expects a CmfProperty? I am using the 1.3-snapshot.
Thanks, Emmanuel On 11/7/05, Geert Bevin <[EMAIL PROTECTED]> wrote: > Hi Emmanuel, > > I don't see why it doesn't work, when I use it, it does. I included > snippets of an example I just wrote to try it out. > > Does this help you? > > ======================== > > <!--BV 'content'--> > <form action="[!V 'SUBMISSION:FORM:sendSex'/]" method="post"> > <!--V 'SUBMISSION:PARAMS:sendSex'/--> > <div class="form_field"> > <div><h3>What is your <strong>Name</strong>?</h3></div> > <div [!V 'name'][!/V]> > <!--V 'ERRORS:name' /--> > <!--V 'FORM:INPUT:name'-->id="name"<!--/V--> > </div> > </div> > <div class="form_field"> > <div><h3>What is your <strong>sex</strong>?</h3></div> > <div [!V 'MARK:sex'][!/V]> > <!--V 'ERRORS:sex' /--> > <!--V 'FORM:RADIO:sex'-->id="sex" style="vertical-align: > middle;"<!--/V--> > <!--B 'FORM:LABEL:sex:M'--> > <a href="javascript:doVoid();">Male</a> > <!--/B--> > <!--B 'FORM:LABEL:sex:F'--> > <a href="javascript:doVoid();">Female</a> > <!--/B--> > <!--B 'FORM:LABEL:sex:X'--> > <a href="javascript:doVoid();">None</a> > <!--/B--> > </div> > </div> > <input type="submit" /> > </form> > <!--/BV--> > > ======================== > > <element implementation="com.uwyn.rife.jumpstart.elements.pub.Home"> > <submission name="sendSex"> > <bean > classname="com.uwyn.rife.jumpstart.elements.pub.Home$InfoBean"/> > </submission> > </element> > > ======================== > > public class Home extends Element > { > public void processElement() > { > Template template = getHtmlTemplate("pub.home"); > if (hasSubmission("sendSex")) > { > InfoBean bean = getSubmissionBean(InfoBean.class); > if (bean.validate()) > { > template.setValue("content", "thanks"); > } > else > { > generateForm(template, bean); > } > } > > print(template); > } > > public static class InfoBean extends Validation > { > private String mName; > private String mSex; > > protected void activateValidation() > { > addConstraint(new ConstrainedProperty("name") > .notNull(true)); > addConstraint(new ConstrainedProperty("sex") > .inList(new String[] {"M", "F", > "X"})); > } > > public String getName() { return mName; } > public void setName(String name) { mName = name; } > > public String getSex() { return mSex; } > public void setSex(String sex) { mSex = sex; } > } > } > > > > How can I do this, and get the collections (radio/select) fields to be > > generated again.... as it stands it returns a blank field for the > > collections. > > > > I tried a forced processElement call, both *before* and *after* the > > generateForm call, but that does not seem to help either. > > -- > Geert Bevin Uwyn bvba > "Use what you need" Avenue de Scailmont 34 > http://www.uwyn.com 7170 Manage, Belgium > gbevin[remove] at uwyn dot com Tel +32 64 84 80 03 > > PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9 > Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net > > > _______________________________________________ > Rife-users mailing list > Rife-users@uwyn.com > http://www.uwyn.com/mailman/listinfo/rife-users > _______________________________________________ Rife-users mailing list Rife-users@uwyn.com http://www.uwyn.com/mailman/listinfo/rife-users