Hi @papamak
I hope you are doing well.
Forminator has some filters and API that could be used for that, but it wouldn’t be possible to save the data and show only a specific one.
I can think of two workarounds for this.
– After the Poll submits, the Forminator add the “other input” value as a Regular form entry: https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/#method-add_form_entry
– After the Poll submits, add the entry to another Poll only visible for Admins: https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/#method-add_poll_entry
Let us know if we are on the same page and we can check the best approach for this.
Best Regards
Patrick Freitas
i want to give an example.
There is a poll with question “Best colour is: ”
and the answers 1.Blue 2.Red 3.Green 4.new one (with Custom Input option Enabled).
User submit an answer
———————
When a user submit his/her answer (for example user vote on answer 1.Blue) there are
1 new entries on table frmt_form_entry with the entry id
2 new entries on table frmt_form_entry_meta with user ip, and meta_key=answer-1 , and meta_value=Blue
User submit a NEW answer-option
——————————-
When a user submit his/her answer (for example user vote on answer 4.new one and input his colour’s new choice WHITE) there are
1 new entries on table frmt_form_entry with the entry id
3 new entries on table frmt_form_entry_meta with user ip, and meta_key=answer-4 , and meta_value=new one, and meta_key=extra , and meta_value=WHITE.
I think (but i don’t know how) is possible to change the way that data import into database when a user submit a new answer or option. Every custom input answer must be a new solid answer on a question. Is this way users can add answers and the poll is more interesting.
i hope you understand what i want….
-
This reply was modified 5 years, 2 months ago by
papamak.
do you have any answer to my message?
How can i do the first workaround that you suggest?
thanks for the support.
Hi @papamak
Sorry for the delay here.
We pinged our developers to verify the first option, and we will update once hearing back from the team.
Best Regards
Patrick Freitas
Hi @papamak
I hope you are doing well.
Could you please try this code as a mu-plugin?
https://gist.github.com/patrickfreitasdev/b885d9f8f5eae24e04e4aaa772bf13e5
https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
The steps:
– Create a new Regular Form, add an input field.
– Update the code, lines 9 and 10 to match your Form ID and Field name.
– Create or in case you already have the poll, get the ID and update the line 13 replacing the 1600 to your custom ID.
If the user selects “Other” and enter a custom value it will add a regular form entry:
https://monosnap.com/file/aEwTrrwQaWVHNFDahs0VIqjfR4dKCc
https://monosnap.com/file/xesJAfq15pZ7SefGTqXVEv4iCmQLeu
You can extend the code following our API documentation:
https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/
Best Regards
Patrick Freitas
hi, thanks for the support.
I followed your’s orders and steps. Sorry, but i think that this is not what i want. Maybe i can’t describe what i want exactly.
I want this feature: visitors may add their own answers. Everytime a user add new answer, this answer is visible to other users to vote for it.
Hi @papamak
Thank you for the information.
In this case yes, the script would be different and I am afraid it would require more customisation which would be out of our support scope.
I believe the script would follow this logic:
Collect the extra input information, on my code you will find how to save it:
https://gist.github.com/patrickfreitasdev/b885d9f8f5eae24e04e4aaa772bf13e5
Get the current Poll using the poll_id variable that you receive in the forminator_polls_submit_field_data filter.
https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/#method-get_poll
Verify if the custom input is not a Poll option, if not, update the Poll using this method:
https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/#method-update_poll
And enter a new Poll entry to that new option:
https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/#method-add_poll_entry
You can reach a developer to create this custom code using the Forminator API documentation page.
Let us know if you have any additional question.
Best Regards
Patrick Freitas
I don’t think that this is complicated.
If you compose #3 message/post from me and your’s orders/steps i think that is possible.
Just think that this feature give extra functionality to your’s plugin (live democracy poll plugin).
Hi @papamak
I hope you are doing well.
Yes, that sounds like a possible feature for the plugin.
We sent this ticket to our developers and designers for further discussion.
I do believe following my steps you or a developer can manage to create a custom code too.
We can’t give any estimated time or if we are going to implement it as a native feature but if more users request the same this can be stronger.
Best Regards
Patrick Freitas
Hi @papamak
I hope you are doing well and safe!
We haven’t heard from you in a while, I’ll mark this thread as resolved.
Feel free to let us know if you have any additional question or problem.
Best Regards
Patrick Freitas