Home Forums General Issues Fields with same names Reply To: Fields with same names

  • I just tried the same thing with 4 types of fields all named “url”; Page Link, URL, File and Image. These all worked on the front end. Is there another field also being saved on the same post with the same name?

    Having fields with the same name, when all but one of the fields is hidden by conditional logic, will work in theory because the values in the fields hidden by conditional logic are not submitted. Basically, only one field with that name can be submitted, if there are multiple fields submitted with the same name then you will run into visible problems.

    There are hidden problems though, for example, if you save a post with “File” selected and then switch to “URL”, the file field named “url” will be hidden and the URL field named “url” will be shown relieving a Post ID as the current value of the field. What happens is that when the field named “url” is saved that the field key pointer is updated to the currently active field type. Honestly, I did not know that this shortcut for field names when using conditional logic existed, and now that I know I probably would not use it. The reason being that the odd display of values when switching the selection would just confuse my average client.

    Anyway, it does seem to be working, I would look at the field names of other fields on the page that are not associated with that group. If you’re cloning the group more than once the you need to be sure to use the field name prefix feature.