The view isn't rendered after you have done the loop. Each line will be rendered with each iteration of the loop. 1 and 2 will have the correct ID and 3 will say 3.
Sean On Feb 19, 1:37 am, David Mineer <[email protected]> wrote: > But if you click on 1 or 2 you still get 3. Wyen the page is done > rendering the value can only be equal to one thing, in this case 3. I > am confusing myself too and typing from my phone. > > On 2/18/09, Chris Blackwell <[email protected]> wrote: > > > > > yes it would, but i dont see what the problem is. you set the value then you > > output the link, both within the loop... > > 2009/2/18 David Mineer <[email protected]> > > >> If that code loops over, say, 10 rows, and you set the id variable in > >> event, aren't you just overwriting it each iteration of the loop? > > >> <cfset event.setValue("id", '1')> > >> <cfset event.setValue("id", '2')> > >> <cfset event.setValue("id", '3')> > > >> Wouldn't event.getValue() = 3 at this point? > > >> On Wed, Feb 18, 2009 at 12:14 PM, Chris Blackwell > >> <[email protected]>wrote: > > >>> Just set it for each row of the query > > >>> <cfloop query="myquery"> <cfset event.setValue("id", myquery.id)> > >>> <cfoutput><a > >>> href="#event.linkTo('some.event','id')#">Link</a></cfoutput> > >>> </cfloop> > > >>> admittedly it doesn't feel quite right doing it like this, but what > >>> problem does leaving the value of id equal to the last row of the query > >>> cause? > > >>> 2009/2/18 David Mineer <[email protected]> > > >>> Ok, I played with setting the value in the event and that works. > > >>>> But I don't think that would work if I was iterating over a query and > >>>> had > >>>> no idea which one of the rows the user was going to click on. Since I > >>>> have > >>>> no idea which of the row id's to set in the event, I wouldn't be able to > >>>> set > >>>> the value into the event, right? > > >>>> And I wouldn't be able to set the event on each row, because at the end > >>>> the event.value would equal the value set from the last row of the > >>>> query. > > >>>> Still a little confusing. Any ideas? > > >>>> Wed, Feb 18, 2009 at 10:06 AM, Sean Coyne <[email protected]> wrote: > > >>>>> in MG3 the viewstate is gone. the event is the same in the controller > >>>>> and in the view. > > >>>>> On Feb 18, 9:38 am, David Mineer <[email protected]> wrote: > >>>>> > Thank you. That makes sense. For some reason I didn't realize you > >>>>> could > >>>>> > mess with the event object in the view. > > >>>>> > On Wed, Feb 18, 2009 at 5:55 AM, Sean Coyne <[email protected]> > >>>>> wrote: > > >>>>> > > The value ID must be set into the event first. > > >>>>> > > so if you have a local variable called ID already set, just set it > >>>>> in > >>>>> > > the event right in the view. > >>>>> > > <cfset id = 1 /> > >>>>> > > <cfset event.setvalue('id',id) /> > >>>>> > > <cfoutput><a href="#event.linkTo('some.event','id')#">Link</a></ > >>>>> > > cfoutput> > > >>>>> > > This will create a link like /?event=some.event&id=1 > > >>>>> > > Sean > > >>>>> > > -- > >>>>> > > David Mineer Jr > >>>>> > > --------------------- > >>>>> > > The critical ingredient is getting off your > >>>>> > > butt and doing something. It's as simple > >>>>> > > as that. A lot of people have ideas, but > >>>>> > > there are few who decide to do > >>>>> > > something about them now. Not > >>>>> > > tomorrow. Not next week. But today. > >>>>> > > The true entrepreneur is a doer. > > >>>> -- > >>>> David Mineer Jr > >>>> --------------------- > >>>> The critical ingredient is getting off your > >>>> butt and doing something. It's as simple > >>>> as that. A lot of people have ideas, but > >>>> there are few who decide to do > >>>> something about them now. Not > >>>> tomorrow. Not next week. But today. > >>>> The true entrepreneur is a doer. > > >> -- > >> David Mineer Jr > >> --------------------- > >> The critical ingredient is getting off your > >> butt and doing something. It's as simple > >> as that. A lot of people have ideas, but > >> there are few who decide to do > >> something about them now. Not > >> tomorrow. Not next week. But today. > >> The true entrepreneur is a doer. > > -- > Sent from my mobile device > > David Mineer Jr > --------------------- > The critical ingredient is getting off your > butt and doing something. It's as simple > as that. A lot of people have ideas, but > there are few who decide to do > something about them now. Not > tomorrow. Not next week. But today. > The true entrepreneur is a doer. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en For more about Model-Glue, check http://www.model-glue.com . -~----------~----~----~----~------~----~------~--~---
