[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Updating Database using form - Select Multiple
Quoting Mathew Jones (mat@booksellersolutions.com):
> I am using IC 4.8.2.
> I have a form which I use to update a table in my catalog. All worked
> fine, until I tried to have a select element, which allows multiple
> selections. The only value which gets written to that database is the
> first value selected.
> Here is a stripped down version of my form:
>
> <FORM METHOD=POST ACTION="[process]">
> <INPUT TYPE=HIDDEN NAME="mv_data_table" VALUE="members_sf">
> <INPUT TYPE=HIDDEN NAME="mv_data_key" VALUE="m_code">
> <INPUT TYPE=HIDDEN NAME="mv_data_function" VALUE="update">
> <INPUT TYPE=HIDDEN NAME="mv_nextpage" VALUE="profileedit">
> <INPUT TYPE=HIDDEN NAME="mv_update_empty" VALUE="1">
> <INPUT TYPE=HIDDEN NAME="mv_data_fields" VALUE="m_code,m_pets">
> <select name="m_pets" MULTIPLE>
> <option value="Dog,">Dog
> <option value="Cat,">Cat
> <option value="Rabbit,">Rabbit
> </select>
> <input type=submit>
> </form>
>
> I added a [cgi m_pets] tag to the top of the mv_nextpage to see what is
> returned. When multiple options are selected the [cgi] tag contains all
> those options eg 'Dog,Cat,Rabbit,', however only Dog, will be written to
> the database.
>
> If possible I would like to avoid having to use javascript to
> concatenate all selected options on submission of the form. Does the
> method I use for updating the DB support 'select multiple'? Any tips
> would be appreciated.
Try adding:
<INPUT TYPE=HIDDEN NAME="mv_data_filter_m_pets" VALUE="null_to_space">
Though I am betting you really want "null_to_colon" and to remove your
commas from the values.
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
The U.S. Senate -- white male millionaires working for YOU! -- Dave Barry