I use the following:
#foreach ($car in $cars)
...
<input type="checkbox" name="selectedCars" value="$car.id" />
...
#end
Then, on the controller side:
public void DeleteCars([ARFetch] Car[] selectedCars)
{
// perform your work
}
For different actions, you could either change the form action thought
javascript, or use buttons:
<button type="submit" name="action" value="delete">Delete Selected Cars</button>
<button type="submit" name="action" value="archive">Archive Selected
Cars</button>
Then add an "action" parameter on your controller:
public void PerformActionOnSelectedCars(string action, [ARFetch] Car[]
selectedCars)
{
switch (action) {
case "delete": ...
case "archive": ...
}
}
--
Fábio David Batista
[EMAIL PROTECTED]
http://nerd-o-matic.blogspot.com
On 7/25/06, Jeremy Arnold <[EMAIL PROTECTED]> wrote:
> I'm brainstorming the best way to solve a problem and figured this was
> a good crowd to present my problem to and hope for an awesome
> solution.....
>
> Lets say I have a table like this...
>
> CarID CarName Sold
> 1 woot false
> 2 winnar true
> 3 honda false
>
> I also have the appropriate model for said table and controller also...
>
> I'd like to make a view displaying each of these records and have a
> check box so I can easily go down a page and mark cars and then do
> certain things with them...... (kind of like with most email clients
> how you can check multiple messages and then delete them, or send them
> to teh spam folder etc etc)
>
> The reference
> http://www.castleproject.org/index.php/MonoRail:Mastering_SmartDispatcherController_and_DataBinds#Advanced
> is quite similar to what I'd liek to do accept I don't exactly know
> how to do it with checkbox's...
>
> Possibly I should create a hidden element for each row and then change
> the value of this element when a check is changed, and the hidden
> element will be passed on to the controller? (as unchecked checkboxes
> are not passed as part of forms)
>
>
> I appreciate any help!
>
> Thanks,
>
> Jeremy
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users