Thread tagged as: Question, Problem, Docs

ID Naming Convention


I was going over documentation and saw that id naming convention "should be lowercase letters, numbers and underscores only."

Will doing a review of a sites templates I see I've used hyphens for a bunch of ids.



Is it critical to rename all the fields that had a hyphen in the id name?

Wanted to ask before going through each template to fix the names. If so, I plan to copy the field, rename it w/out hyphen then copy and paste data into new field and when finished delete field with wrong id name so we don't lose any data in the database.

Moving forward I will use the correct naming convention.

Scott Gruber

Scott Gruber 0 points

  • 6 years ago

Best practice is to use underscore, or CaMelCase

I can't think of an example right now, but in the past I ran into trouble with hyphens.

Critcial, I don't think so, but best practice, underscore___


I like to do something along these lines...

name_first, name_last, address_street, address_city, address_state

Thank you Robert.

Have begun to update template ids to underscore naming rule.

EDIT - Fixing it on my end was painless. Moved through a collection quickly using the nav arrows (find on lower right part of the data entry screen) plus the keyboard shortcut to save (command+s on macs). I enjoy these little details in the Perch admin UI to help edit content.