Chris Kimpton wrote:
> I have an object which has a "part" object - an ad for a property and sub-object of
>things it is close to, eg train station, school etc.
>
> There is a list of around 20 of these "close to" things - I want to have a block of
>checkboxes that the user just clicks for the relevant items. I want to put this on
>the same page as my "ad" insert/update page.
>
> Thus my thoughts on how to do this with Turbine/ECS are as follows;
>
> on display, spit out the required ECS/input fields, named something like close_to_1,
>close_to_2 etc
>
> on processing the form, do the usual first pass with setProperties to sort out the
>"ad" itself. And then process the parameters again to get all the checkbox settings
>and create the appropriate sub-objects.
>
> Does this make sense? Anyone got any alternatives?
Why would you do that? ECS is just as good as having HTML inside
out.println() all over your code, but it looks uglier :).
take a look at that
<form action="">
#foreach $ad in $ads.getIds() #begin
<input type="hidden" name="ad" value="$ad">
address <textarea name="address_$ad">$ads.getAddress($ad)</textarea><br>
description <textarea name="description_$ad">$ads.getDesc($ad)</textarea><br>
close to train station <input type="checkbox" name="close_1_$ad"
$ads.getCloseto(1,$ad)>
close to church <input type="checkbox" name="close_2_$ad" $ads.getCloseto(2,$ad)>
...
#end
<input type="submit">
</form>
Of course you could use a loop to create the checkboxes too if you wanted.
You are right about the second part. You use String[] ids =
data.getParameters().getStrings("ad");
and then search the parameters for names ending in particular id.
Rafal
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]