Hi Henk,
I'm afraid you will not be able to use the form generation for this
since as far as RIFE is concerned there is only one value:
'FORM:INPUT:textArray', it just is present in several locations. I
might be able to fix this by adding support for array indices to the
form generation, but I can't get to it right away. This would then
allow you to use 'FORM:INPUT:textArray:0' and 'FORM:INPUT:textArray:
1' to refer to the individual values. If you're interested in this,
please submit an issue to Jira. I might be able to get it done
somewhere next week. In the meantime, you'll have to set the values
manually into regular html input field tags.
Best regards,
Geert
On 19 Jul 2006, at 10:07, henk wrote:
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
--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users