Hi ,

I should be punished, I made a big mistake guys.. here it goes...

The variable $opportunity.additional_provinces_821102568 represents Multiple
checkbox, Now when I print this field it gives me all the values which the
user has selected on the form. 

Now the only thing I have to do is to read the values from this varibale and
then add a associate string based on the value.

thus 

$opportunity.additional_provinces_821102568;
#set($value = $opportunity.additional_provinces_821102568);
#if ($value.contains("Quebec"))
        #set($opt = "CSST");
#end
#if ($value.contains("Ontario"))
        #set($opt = $opt + "WISB");
 #else
        #set($opt = $opt + "WISSB");
#end

$opt

but this produces the output as 

Manitoba,Nova Scotia,Quebec#set($value = Manitoba,Nova Scotia,Quebec);;$opt

Barbara Baughman wrote:
> 
> 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]
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Velocity-html-help-tp28019574p28020409.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]

Reply via email to