Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi,
How should I approach this:
I have a template with an editable type 'relation' having many-to-many relation with other clonable template say location.php.
On front-end, I am using jquery's select2 multi-select to select multiple locations as I cannot display lots of locations with checkboxes. Hence, I am considering select2 is best option for front-end to select multiple values.
After selecting all required location on front end form, I am getting values of page id (page id of location.php) as variable in javascript like this:
Code: Select all
var items = ["14", "20", "15", "44"];

or
Code: Select all
var items = 14,20,15,44 ;


I want to submit the form with these page ids like this:

Code: Select all
<db_persist_form
locations=selected_locations >

where selected_locations should be the values of variable 'items' in javascript.
the real problem is how do I store these values on form submission to the database.

thanks!
Hidden input, no?
yea! solved using hidden input as follows:
Code: Select all
<cms:input type='text' style='display: none;' name='selected_locations' id='selected_locations' />


for anyone viewing this:
do no use type='hidden' as you will not be able to fetch the value on submit.
3 posts Page 1 of 1

Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 11 guests