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:
or
I want to submit the form with these page ids like this:
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!
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!