Thanks for your response Victor. Do you know why there was an error detected in line 4 of the code?:
if(isset( $_GET['copy_entry']) && !in_array( $field->type, array("hidden", "divider", "html", "end_divider", "user_id" )
I deactivated the duplicate of the snippet and the plugin introduced a "critical error" on my site. The hosting provider had this to say in fixing it:
"Your website and database have been reverted to account for the error introduced by the bad snippet. I've installed the plugin again. Please be very careful because, as you discovered, this does break the site if bad code is pushed."
Do you think it could still be an issue with the snippet apart from having the duplicate? I'm hesitant to try it again after that happening, Thanks.
Does this also work with repeater fields in a multi page form?
@mattclute, You have open parens in the line you are asking about. It should be:
if( isset( $_GET['copy_entry'] ) && !in_array( $field->type, array("hidden", "divider", "html", "end_divider", "user_id" ) ) )
@Teddet, This snippet is not designed to work with repeaters. Repeaters are, in actuality, embedded forms. Each row is a new form entry. It may be possible to duplicate repeater rows with Ajax or jQuery, but I've never tested this because no one has ever asked for this capability.
This article explains how repeaters work. Perhaps it will inspire you to a solution. https://formidable-masterminds.com/repeaters-and-complex-jquery-operations/
Thanks for your response Victor.
It looks like I didn't enter the line that caused the error correctly in my original comment. The original code snippet from FormsCity that caused the error on line 4 actually matches your entry. I wonder if @Teddet was on to something when asking about compatibility with multi-page forms? Given that my form is 5 pages in length.
You might be getting some place Matt. Have you ever examined the source code for a multi-page form in the browser? Formidable changes field types to hidden for any field not displayed on the currently viewed page. This could be the problem because you are skipping hidden fields in the snippet. I don't know what's causing your error though. You need to enable WordPress debug to get more details.
Yeah I have the exact need to duplicate form entries with repeater fields - shocked that it isn't easier - or already an option. Even the 'duplicate' function on the form entry page doesn't do it, which to me mean that it is in-fact not a 'duplicate' function as well, it doesn't actually duplicate the entries. Totally get that they are their own "form entry id" within another form though - I know I can probably pythonically duplicate the data, but not the strongest in php for this....
Please login or Register to submit your answer