Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-07-23 16:52:14

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

custom field to select multiple

Hi at all.

I have a problem with a custom field.

I use an ob_start(‘buffer’) function to sobstitute a custom field with a select filed with multipleselect option active.

The html code is:
from

<p><label for="custom-3">Inputfile</label><br /> <input type="text" value="" name="custom_3" size="22" class="edit" id="custom-3" /></p>

to

<p><label for="custom-3">Inputfile</label><br /> <select multiple="multiple" size="5" name="custom_3" class="list" id="custom-3"> <option value="5">exe5</option> <option value="2">exe2</option> <option value="3">exe3</option> <option value="4">exe4</option> <option value="1">exe1</option> </select></p>

If i choose two or more option and publish/save the article, only the first option selected was saved.
There is a reason for that?

Last edited by MarcoK (2009-07-23 16:52:49)

Offline

#2 2009-07-24 08:58:19

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: custom field to select multiple

no one can help me?

Offline

#3 2009-07-24 10:19:28

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: custom field to select multiple

ok, i foud the errror.

I must insert into name=“custom_3” of the select the array parameter name=“custom_3[]”.

So the function not work however.

It will return me this error

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in F:\wamp\www\txp\textpattern\lib\txplib_misc.php on line 11

some ideas?

Offline

#4 2009-07-24 14:32:12

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: custom field to select multiple

Instead of replacing the text box can you hide it and then using javascript put the selected values from your select into the textbox for submitting?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#5 2009-07-24 15:35:07

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: custom field to select multiple

glz_custom_fields looks like it has this ability.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#6 2009-07-24 15:45:09

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: custom field to select multiple

MattD wrote:

Instead of replacing the text box can you hide it and then using javascript put the selected values from your select into the textbox for submitting?

yes, i have try width jquery and so, with a esay code ihave obtained this result.

But i ‘m tryng to find a solution without js.

Offline

Board footer

Powered by FluxBB