FC 1.5.6 - fieldnames - no dash line allowed

More
12 years 2 months ago #22398 by Rehne
Hi,

i think it's not really a bug
but worth knowing
especially when you will update from FC 1.5.4 to 1.5.6 (r1133)
i did it on a lokal test server

explanation:
because of the existing fields improvements with nice new features (e.g. the image-field-plugin)
i once opened a self-applied field to change (new) settings
the name of the field would be written with a dash line (e.g. event-date)
that was previously not a problem
and also in the new version, the field is evaluated
but I can't save it more in the new FC version
the Problem ist the dash line in the name
this should unfortunately probably not be used in FC 1.5.6 (r1133)!?
the following error appears

Your field name is not correct, it was changed from 'event-date' to be field56 already.


this means for people who want to update
and have already created a lot of custom fields with a names contains a dash line (e.g. event-date)
he has this name wherever it is used (Plugin-Paramter, Template) to adjust
dash lines in field-names are not allowed

or is it a bug !?

Regards

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #22408 by ggppdk
Field name is used in HTML output for HTML TAG class parameter name, for various fields (if remember correctly, these are: related items field, and maybe image field and mini-gallery fields), for HTML TAG id parameter they are OK.

But class names with dash in the name do not work. I guess we could remove the limitation and take care to replace dash with underscore in the PHP code.

So, we could allow the dash,
but an unsuspecting developer may create a field that uses field name in the class name, and the field would break as soon as the user will create a field with dash in the name.

What do you think?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #22409 by Rehne
ooohh ... sorry my bad english
we are talking about the same?
i mean by dash lines = hyphens = binder strokes (in German: Bindestriche)
and hyphen (-) are a valid character in CSS and HTML identifiers (i mean)
so what are the advantages using underscore (_)?

... if you are going to be doing programming to manipulate the DOM or passing identifiers such as form names to programming languages, usually underscores are nicer
For example:

Code:
<input type="text" name="my_input" id="my_input" /> <input type="text" name="my-input" id="my-input" />
If you are scripting it, you can do var my_input = document.getElementById('my_input'); or parse the incoming value when POSTed to php with <?php $my_input = $_POST; ?>. However, the hyphens version won't be translatable in either JavaScript or PHP because hyphens are not allowed there.


so I think your underscore variant is better

But class names with dash in the name do not work. I guess we could remove the limitation and take care to replace dash with underscore in the PHP code.


but an unsuspecting developer may create a field that uses field name in the class name, and the field would break as soon as the user will create a field with dash in the name.


irrespective of using an underscore or a hyphen (spaces are also not allowed so far as I know)
it would be almost certainly be useful
show the user a help text with example

Regards

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #22420 by ggppdk
Right, in r1135:
i have added a better warning that display allowed characters when user enters and invalid field name


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.553 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline