Hi Geert,
I downloaded the rife-1.6M1-snapshot-jdk15-20060718.jar file in order to
try out the array properties handling (replacing the 1.5 jar).
I only get as far as to fill in the array, validation and redrawing the
values does not work, probably because I'm missing something.
Here's my bean and the associated metadata :
public class SubmissionBean {
private String[] textArray;
public String[] getTextArray() {
return textArray;
}
public void setTextArray(String[] textArray) {
this.textArray = textArray;
}
}
public class SubmissionBeanMetaData extends MetaData {
@Override
public void activateMetaData() {
addConstrainedPropertyRules(new
ConstrainedProperty("textArray").notNull(true).minLength(1));
}
}
My form :
<form name="submit" action="${v SUBMISSION:FORM:submit/}">
<r:v name="SUBMISSION:PARAMS:submit" />
<r:v name="FORM:INPUT:textArray"/>
<r:v name="FORM:INPUT:textArray"/>
<input type="submit" />
</form>
My element :
<element implementation="cooker.Cooker">
<submission name="submit">
<bean classname="cooker.SubmissionBean"/>
</submission>
</element>
If I fill in different texts in the input fields, I receive them
correctly in the array. The array contains two different values.
But, when redisplaying the form, both input fields contain the first
value and the validation is not being performed.
The code :
public void doSubmit(){
String valid=null;
SubmissionBean data = getSubmissionBean(SubmissionBean.class);
Validated validData = (Validated)data;
if (!validData.validate()) {
valid = " not valid ";
} else {
valid=" valid ";
}
generateForm(templ,data);
templ.setValue("data",valid +
StringUtils.join(data.getTextArray(),","));
templ.appendBlock("answer","answer");
print(templ);
}
Any ideas ?
Thanks
Henk
henk wrote:
Geert Bevin wrote:
I added code that should fully support this. It will automatically
populate a bean with for example Date[] as a property time, validate
the validity of every single one of the values that have been
submitted. You just have to provide the values for a form input field
that has one particular name (ie. multiple values for one name).
You can download it from the snapshots tomorrow, or build RIFE
yourself now ;-)
Take care,
Geert
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users