The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Delete first entry of a Repeater Section

Labels

This Discussion is public

Notifications

Is it possible to delete the first form entry in a Repeater Section?

Out of the box, there is no Remove button for the first entry, however, is there a piece of code I could use to make this possible?

Thanks. Gavin.


Attachment:

Gavin,

You can do this by editing the code in FrmProNestedFormsController.php within your plugin files.

Scroll to line 821 and change:

 

// Hide Remove button on first row
if ( $args['row_count'] === 0 ) {
$args['remove_classes'] .= ' frm_hidden';
}

 

to

 

// Hide Remove button on first row
if ( $args['row_count'] === 0 ) {
$args['remove_classes'] .= ' ';
}

Thanks Chachi - will this be overwritten when the plugin is updated?

Perhaps a function in a functionality plugin would be a better route, and also allow target specific forms. I imagine amending the core file will make the change apply to all forms?

Thanks again. Gavin.

Ps.

you could also look at using Javascript - that could be a quick method and you can target specific forms by only using the custom Javascript on the desired form.

You can do this with jQuery:

jQuery(document).ready(function ($) {
"use strict";

$(function (){
if ( $('#frm_section_87-0 a.frm_remove_form_row').hasClass('frm_remove_form_row') ) {
$('#frm_section_87-0 a.frm_remove_form_row').removeClass('frm_hidden');
}
});
});

Change #frm_section_87-0 to the ID of your repeater. I tested this on my dev site and it works. You may need to tweak it for your site though.

Add this code, with the script tags to the after fields section of your form's Customize HTML page.

Discussion closed.