Where are you getting your syntax for rules from? Please read the service howto:
http://jakarta.apache.org/turbine/turbine-2/services/intake-service.html Also you are not setting the rule required=true anywhere, so intake would not report a null field as invalid. john mcnally Maciej Leks wrote: > > Hi! > > Thanks for help and explanations...But I have still some problems...In the Intake XML > file I have one group with two fields. Fields have rules i.e a field > can not be empty, etc. > > <group name="Person" key="p" mapToObject="om.Person"> > <field name="Name" key="name" type="String" mapToProperty="Name"> > <rule maxLength="5">Name length cannot be > 5</rule> > <required-message>This module requires data for this >attribute.</required-message> > </field> > > <field name="CityId" key="cityid" type="NumberKey" mapToProperty="CityId"> > <rule mask="[0-9]+">badIdMessage</rule> > </field> > </group> > > In the HTML form I have: > > <form method="post" >action="$link.setPage("InsertPersonIntake.vm").setAction("InsertPersonIntake")"> > ... > #formCell ("First and Last Name" "$personGroup.Name.Key" "$!personGroup.Name") > ... > <select name="$personGroup.CityId.Key" size="1"> > #foreach($city in $cities) > #if ( $!personGroup.CityId == $city.CityId ) > <option value="$city.CityId" selected>$city.name</option> > #else > <option value="$city.CityId">$city.name</option> > #end > #end > </slect> > ... > <input type="submit" name="eventSubmit_doInsert" value="Insert"/> > ... > > InsertPersonIntake screen class is resonsible for preparing iterator > with cities names and ids. > > The java action code looks like this: > > public void doInsert(RunData data, Context context) throws Exception > { > IntakeTool intake = (IntakeTool) context.get("intake"); > > if ( intake.isAllValid() ) > { > String template = data.getParameters().getString("nextTemplate", >TurbineResources.getString("template.homepage", "Index.vm") ); > > setTemplate(data, template); > } > else > { > setTemplate(data, "InsertPersonIntake.vm"); > } > } // > ...almost like how-to example. > > But, it is not working...After handling the form action always I am > redirected to the Insert.vm page (intake.isAllValid() returns always > true), though the form was not full, what is not accordancing with the > rules! And the form data are always null!!! > > My question is: What is going on? > Help me....:-( > > -- > > Leksiu mailto:[EMAIL PROTECTED] > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
