-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need examples for multiple value multi-option custom fields with AJAX #99
Comments
I ripped this from my working code, hope it helps. Where $_POST['subscriptions'] is stored in the form like
|
Thanks so much for your help @troyrasiah. Are you able to please provide the full PHP code block? As I'm a bit of a PHP newbie and unsure of how $addSubscriber fits in with the wrapper provided —
|
No problems, pretty much the same as what you have pasted. This is what else I have in addSubscribers
|
Thanks @troyrasiah, you're a serious lifesaver. This worked a treat. For anyone else who may run into this problem, you can reference the full code below with HTML as above. JQuery
PHP
|
do you need unique names for the checkbox options?
really stuck on this and tried multiple checkbox with same name subscriptions But just note getting through to CM. |
@troyrasiah could you post your final markup for the html form element? Followed this to a T but rstuck and tried everything possible! |
So I have 2 checkboxes in my form. They have the html code as follows
Which relates to the PHP from my previous post (Adds multiple elements to $addSubscriber['CustomFields']) Any issues just give me a yell |
Hey there,
I'm trying to capture data from a form to multi-option custom fields with multiple inputs.
I have it all set up, but need examples to demonstrate pulling in multiple values and passing that through the 'CustomFields' array. The examples suggest repeating the array with the same 'Key' and different 'Values', eg
This works fine. However this doesn't show how to dynamically add these arrays into the 'CustomFields' array. For example by pulling the data in with AJAX, processing the JSON array into PHP and then adding to the 'CustomFields' array. Are you able to please help with this?
An example:
HTML
JQuery
I've attempted plenty of ways of achieving this in PHP, but I cannot get this to work. I am guessing a new array is needing to be stored in a variable and inputted as the 'CustomFields' value? The code below is terrible, but just for a demonstration of what I need to achieve.
PHP
Any and all help is much appreciated!
The text was updated successfully, but these errors were encountered: