Emmanuel Okyere wrote:
[snipped]
You are pretty much on the money with what the discussion is about;
it's not possible to 'generate' a form in the manner you mention here,
but you can sort of 'simulate' that; what I am doing on the petstore
app for instance, requires that every cart item be shown as part of
the cart form... this in itself is something rife easily allows you to
do by having a a value placeholder and blocks that you can iteratively
process and append per bean instance... the added complexity comes in
because as per the cart reqts, I have to have a quantity textfield
that allows the user to update qty per item.
rife currently supports a getSubmissionBean(BeanType.class) method
which allows you to easily get an instace of the bean returned from
teh form, and do validation against that... it would be nice (and I
might have to look into this) to be able to make a similar call, only
this time to retrieve a list/array of the beantype you require.
Currently, I am sending back parameters in my submission; like:
<submission name="process">
<param name="id" />
<param name="iid" />
<param name="quantity" />
</submission>
and using getParameterIntValues(paramString) call in my Element
implementation to iterate over these values and recreate the beans
just as I would have expected a call to a proposed getSubmissionBeans
to have worked.
We might hv to think this through and see if it's possible/feasible to
implement something of the sort as a feature of the framework.
Cheers,
Emmanuel
Emmanuel,
I join this discussion a little bit late, I guess, but I thought what I
had to share might be useful to you.
Why don't you create a CartBean class that has array properties?
For example:
class CartBean {
private String[] ids; // assuming your ids are of type String
private String[] iids;
private long[] quantities;
... and so on
}
Then, in your template, whether you use JavaScript or not, use the same
names as the properties in your bean for your input controls.
getSubmissionBean(Class) is clever enough to fill in array values into
the properties of the submitted bean, which you can then process.
In short, you shouldn't have to use a bean per item; you need only use
one bean for the cart.
Regards,
Eddy
--
http://coding.mu
http://priscimon.com/blog
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users