Wait a minute.

You are iterating through $opportunity.additional_provinces_821102568 and
during every iteration new value is set to $additional_province. So why the
hell
you are checking this way
"$opportunity.additional_provinces_821102568.checked" instead of
"$additional_province.checked"?

PS you could compare strings with "==" sorry to puzzle you with that.

On 25 March 2010 01:09, Anil h k <[email protected]> wrote:

>
> Yes I did, below is the updated code.
>
> #foreach( $additional_province in
> $opportunity.additional_provinces_821102568)
> {
>
>        #if ($opportunity.additional_provinces_821102568.checked == true)
>        {
>                 #if
> ($opportunity.additional_provinces_821102568.equals("Quebec"))
>                {
>                        #set($value1 = "CSST");
>                }
>                #end
>                #if
> ($opportunity.additional_provinces_821102568.equals("Ontario"))
>                 {
>                        #set($value1 = $value1 + "WSIB");
>                }
>                #else
>                {
>                        #set($value1 = $value1 + "WSB");
>                }
>                #end
>        }
>        #end
> }
> #end
>
> Have made a few changes. I know the problem is simple I am just
> complicating
> things. I have 12 multiple checkboxes I need to check if each is checked or
> not. If one is checked I need to check the value for that checkbox and if
> the value matches the text in quotes I need to do some operation.
>
> Thus which means I need to run a for loop for 1 to 12 now javascript
> accepts
> for(i=0;i<12;i++) velocity needs foreach.
>
> 2 problem : in foreach the variable $additional_province should be
> initialised but to what ?
> i am not able to get this at all...questions.. questions and more
> questions.
>
>
> Alexander Krasnukhin wrote:
> >
> > Not sure, haven't used Velocity for a long time but comparing strings
> with
> > "==" doesn't seems right. Have you tried equals instead?
> >
> > On 25 March 2010 00:47, Anil h k <[email protected]> wrote:
> >
> >>
> >> Hi ,
> >>
> >> I am trying to read a multiple checkbox in velocity this is my code.
> >>
> >> #foreach( $additional_province in
> >> $opportunity.additional_provinces_821102568)
> >> {
> >>        #if ($opportunity.additional_provinces_821102568.checked == true)
> >>        {
> >>                #if ($opportunity.additional_provinces_821102568.value ==
> >> "Quebec")
> >>                {
> >>                        #set($value1 = "CSST");
> >>                }
> >>                #end
> >>                #if (additional_provinces_821102568.value == "Ontario")
> >>                {
> >>                        #set($value1 = $value1 + "WSIB");
> >>                }
> >>                #else
> >>                {
> >>                        #set($value1 = $value1 + "WSB");
> >>                }
> >>                #end
> >>        }
> >>        #end
> >> }
> >> #end
> >>
> >> can anyone let me know what is wrong in this.. i just cannot get this
> >> right
> >> .
> >>
> >> thanks !
> >> --
> >> View this message in context:
> >> http://old.nabble.com/Velocity-html-help-tp28019574p28019574.html
> >> Sent from the Velocity - User mailing list archive at Nabble.com.
> >>
> >
> >
> >
> > --
> > Regards,
> > Alexander
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Velocity-html-help-tp28019574p28019857.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Regards,
Alexander

Reply via email to