You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Luke Majewski <lu...@verizon.net> on 2003/03/28 05:32:12 UTC

passing info from multiple select list

I'm having trouble passing the information from my multiple select list in Velocity to my java code.

<select multiple size=6 name=resourceLanguageId[]> 

        #foreach ($lang in $languages) 
            <option value="$lang.id"  
            #if ($lang.flag) selected #end
        >$lang.name
        #end

    </select>

Displaying the select list items is fine, it's how to tell my java code which items are selected that's giving me trouble .  Can anyone point me the right direction?

Thank you,

Luke Majewski
Center for Promotion of Child Development Through Primary Care

Intake and NLS support

Posted by Thomas Vandahl <th...@hm-informatik.de>.
Hi folks,

I dunno if this has been asked before, but: What is a kosher way to
implement NLS-support (e.g. with numbers) with Intake? I made some
changes in the BigDecimalField and FloatField classes to accept numbers
entered based on the current Locale (TDK 2.2, that is).

The other way round, numbers are formatted using a
ReferenceInsertionEventHandler. This all works but it leaves several
things to be desired:

- It would be better to handle all this inside Intake. Where is the
place to look for the final toString()-Method?
- At the moment I can only format numbers based on their Class. It would
be better to make a Format string available to each of the number
fields. Intake.xml seems to be a good place to do this. Or is there a
better way?

I guess these features have been discussed beforee but I could not find
something in the archive.

Thanks for any hints.

Bye, Thomas.


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


RE: passing info from multiple select list

Posted by Chris K Chew <ch...@fenetics.com>.
Here is one way to do it...I imagine there lots of other ways:

You need two arrays, one for your available languages and one for your
selected languages.  Loop through each available language, and for each
available loop through the array of selected -- if the current available
language exists in the selected array, then put the "SELECTED" in the
<option> tag.  Below is an example:

<select multiple size=6 name=resourceLanguageId>

#foreach ($lang in $languages)
  #set( $selected = "" )
  #foreach ($slctlang in $selectedLanguages)
    #if( $lang.id == $slctlang.id)
      #set( $selected = "SELECTED" )
    #end
  #end
  <option value="$lang.id" $selected>$lang.name</option>
#end

</select>

NOTE:  You don't need the "[]" in "resourceLanguageId[]" in Turbine.  Use
the data.getParameters().getStrings() to fetch an array.

ANOTHER NOTE:  You can simplify this a little using Intake and the
multiValued="true" field attribute.

Good luck,

Chris


> -----Original Message-----
> From: Luke Majewski [mailto:luke.majewski@verizon.net]
> Sent: Thursday, March 27, 2003 9:32 PM
> To: turbine-user@jakarta.apache.org
> Subject: passing info from multiple select list
>
>
> I'm having trouble passing the information from my multiple
> select list in Velocity to my java code.
>
> <select multiple size=6 name=resourceLanguageId[]>
>
>         #foreach ($lang in $languages)
>             <option value="$lang.id"
>             #if ($lang.flag) selected #end
>         >$lang.name
>         #end
>
>     </select>
>
> Displaying the select list items is fine, it's how to tell my
> java code which items are selected that's giving me trouble .
> Can anyone point me the right direction?
>
> Thank you,
>
> Luke Majewski
> Center for Promotion of Child Development Through Primary Care


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