You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Anil h k <an...@gmail.com> on 2010/03/24 19:47:18 UTC

Velocity html help

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.

Re: Velocity html help

Posted by Anil h k <an...@gmail.com>.
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 <an...@gmail.com> 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: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 
> 
> 

-- 
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: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Velocity html help

Posted by Barbara Baughman <ba...@utdallas.edu>.
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 <an...@gmail.com> 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: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Velocity html help

Posted by Anil h k <an...@gmail.com>.
resolved.. now it looks as a piece of cake :P

#if ($opportunity.additional_provinces_821102568.contains("Quebec")) 
#set($val1 = "CSST") $val1
#end #if ($opportunity.additional_provinces_821102568.contains("Ontario"))
#set($val2 = "WISB")  $val2 #end 

that simple. and yes contains did work :)

thank u all 

Alexander Krasnukhin wrote:
> 
> 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 <an...@gmail.com> 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 <an...@gmail.com> 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: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
> 
> 
> -- 
> Regards,
> Alexander
> 
> 

-- 
View this message in context: http://old.nabble.com/Velocity-html-help-tp28019574p28023133.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Velocity html help

Posted by Alexander Krasnukhin <th...@gmail.com>.
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 <an...@gmail.com> 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 <an...@gmail.com> 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: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>


-- 
Regards,
Alexander

Re: Velocity html help

Posted by Anil h k <an...@gmail.com>.
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 <an...@gmail.com> 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: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Velocity html help

Posted by Alexander Krasnukhin <th...@gmail.com>.
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 <an...@gmail.com> 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

Re: Velocity html help

Posted by Barbara Baughman <ba...@utdallas.edu>.
Try 
#set($value1="${value1}WCC")

So value1 is set to the String within the quotes. That String is written as you would any String in a Velocity template, but within quotes.



Barbara Baughman
Systems Analyst
X2157


Anil h k wrote:
> Hi Alexander.
> 
> compare does not work, in a variable say "a" i have Quebec,Northen territory
> (these are the selected values from the multiple checkboxes) 
> 
> now say if in "a" I have quebec I need to set a value for varible as WCC. 
> 
> then if "a" has "northen territory" I need to set is as "wcc" + wccB" this
> wccb will get  added (concatinate) if northern territory is present.
> 
> any idea how this works ? i tried concatincation but the output comes as wcc
> + wccb :(
> 
> Alexander Krasnukhin wrote:
>> Are you sure about *compare*?
>>
>> On 25 March 2010 01:20, Robert Lee <Ro...@rcn.com> wrote:
>>
>>> compare:   #if($a = "test")
>>> assign:    #set($a = "test")
>>>
>>>
>>>
>>> On 3/24/2010 2:47 PM, Anil h k 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 !
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>
>> -- 
>> Regards,
>> Alexander
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Velocity html help

Posted by Anil h k <an...@gmail.com>.
Hi Alexander.

compare does not work, in a variable say "a" i have Quebec,Northen territory
(these are the selected values from the multiple checkboxes) 

now say if in "a" I have quebec I need to set a value for varible as WCC. 

then if "a" has "northen territory" I need to set is as "wcc" + wccB" this
wccb will get  added (concatinate) if northern territory is present.

any idea how this works ? i tried concatincation but the output comes as wcc
+ wccb :(

Alexander Krasnukhin wrote:
> 
> Are you sure about *compare*?
> 
> On 25 March 2010 01:20, Robert Lee <Ro...@rcn.com> wrote:
> 
>> compare:   #if($a = "test")
>> assign:    #set($a = "test")
>>
>>
>>
>> On 3/24/2010 2:47 PM, Anil h k 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 !
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
> 
> 
> -- 
> Regards,
> Alexander
> 
> 

-- 
View this message in context: http://old.nabble.com/Velocity-html-help-tp28019574p28023132.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Velocity html help

Posted by Alexander Krasnukhin <th...@gmail.com>.
Are you sure about *compare*?

On 25 March 2010 01:20, Robert Lee <Ro...@rcn.com> wrote:

> compare:   #if($a = "test")
> assign:    #set($a = "test")
>
>
>
> On 3/24/2010 2:47 PM, Anil h k 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 !
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>


-- 
Regards,
Alexander

Re: Velocity html help

Posted by Robert Lee <Ro...@rcn.com>.
compare:   #if($a = "test")
assign:    #set($a = "test")


On 3/24/2010 2:47 PM, Anil h k 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 !
>    

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org