OK Geert,
I changed the ConstrainedPropertys to CmfProperty and it is working as
expected when the form is submited.
What I have noted is, as this is the same set of Constraints I was
placing on it initially, the problem seems to be with the dynamically
generated resources attached to the template..
so that while the following code in the implementation
[code]
tt.getBeanHandler().getFormBuilder().generateField(tt,
new ConstrainedProperty("sex").inList(new String[] {"M", "F", "X"}),
null, "");
[/code]
worked when the page loaded, but failed to generate the collection
after a submission (with generateForm), the following in the bean
[code]
addConstraint(new CmfProperty(SEX).inList(new String[] {"M", "F", "X"}));
[/code]
works perfectly both on page load and after submission. Can you
comment on the difference?
Also, on the same form, I have a date dropdown list that I am
generating dynamically, and using the following code
[code]
template.addResourceBundle(new ListResourceBundle() { blah
[/code]
to add to the template, in the implementation. That *still* doesn't
work; that is, it generates the dropdown on page load, but fails to do
so after a submission... and this comes back to the dynamic (in
implementation) versus static (in bean class) scenario I mentioned
earlier.
Any pointers?
Thanks,
Emmanuel
On 11/7/05, Emmanuel Okyere <[EMAIL PROTECTED]> wrote:
> 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
> > [email protected]
> > http://www.uwyn.com/mailman/listinfo/rife-users
> >
>
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users