http.Request.FormValue for multiple select

518 views
Skip to first unread message

Hicham Bellahcene

unread,
May 22, 2013, 5:00:49 AM5/22/13
to golan...@googlegroups.com
Hello

I have this in my webform

<select multiple="multiple" name="appName">
    <option id="appName1">appName1</option>
    <option id="appName2">appName2</option>                              
</select>


When I try to send my form with appName1 and appName2 selected and print the value with

appName := r.FormValue("appName")
fmt.Println("Application Name -> ", appName)


It's print only Application Name -> appName1.

Do you know please how I can get the two selected values ?

Thanks for your help

Matthew Kane

unread,
May 22, 2013, 5:26:57 AM5/22/13
to Hicham Bellahcene, golang-nuts
Call r.ParseForm(), and r.Form["appName"] should be a slice containing both.
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
matt kane
twitter: the_real_mkb / nynexrepublic
http://hydrogenproject.com
Reply all
Reply to author
Forward
0 new messages