I'm still using an older version of Velocity, but this observation may still 
hold true.

I think the problem may be the reference to a name with an underscore (_).  Velocity 
references generally end at punctuation marks, so it's only looking for the reference 
$opportunity.additional.  Check the velocity log to see if there is an "Invalid 
Reference" message for $opportunity.additional.

In your #foreach statement, don't name the reference $additional_province, 
because it has an underscore.  Not sure why $additional_province is even 
defined, since you never reference it in the foreach loop.

Instead of $opportunity.additional_provinces_821102568, you may use the full 
method reference to eliminate the underscore confusion.
$opportunity.get("additional_provinces_821102568")
Barbara Baughman
Systems Analyst
X2157


Anil h k 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




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to