[Plugin: Custom Field Template] Duplicate input ids on multiple fieldsets
-
Hello,
I’ve come across something which is causing a few problems.
I am successfully using multiple field sets except for the type = file field.
Basically, when you hit Add New, it duplicates the above field including the id. So, If I add an image the the new field set, it affects the field above – deleting.
I’ve spotted this line of code in the plugin which seems to clone all above on Add New. I guess all we need to be able to do is increment the id also.
Anybody got a solution?
$addfield .= ' <a href="#clear" onclick="var tmp = jQuery(this).parent().parent().parent().clone().insertAfter(jQuery(this).parent().parent().parent());tmp.find('."'input[type=text],input[type=hidden],input[type=file]'".').val('."''".');tmp.find('."'select'".').val('."''".');tmp.find('."'textarea'".').val('."''".');tmp.find('."'input'".').attr('."'checked',false".');if(tmp.find('."'input[type=radio]'".').attr('."'name'".')){if(tmp.find('."'input[type=radio]'".').attr('."'name'".').match(/\[([0-9]+)\]$/)) { matchval = RegExp.$1; matchval++;tmp.find('."'input[type=radio]'".').attr('."'name',".'tmp.find('."'input[type=radio]'".').attr('."'name'".').replace(/\[([0-9]+)\]$/, \'[\'+matchval+\']\'));}}jQuery(this).parent().css('."'visibility','hidden'".');return false;">' . __('Add New', 'custom-field-template') . '</a>';
https://www.ads-software.com/extend/plugins/custom-field-template/
- The topic ‘[Plugin: Custom Field Template] Duplicate input ids on multiple fieldsets’ is closed to new replies.