Skip to Content Skip to Menu

[#5041] Invalid Html?

  • KatoKalin
  • KatoKalin
  • OFFLINE
  • Posts: 265
  • Thanks: 11
  • Karma: -5
  • Add-ons
9 years 9 months ago - 9 years 9 months ago #257609 by KatoKalin
[#5041] Invalid Html? was created by KatoKalin
As far as I can see, using substitution [cb:userfield field="FIELD_NAME" formatting="div" reason="list" /] as layout option will result in invalid Html.

Using this, each of these field will get the same div id, cbfv_FieldId. As this id exists multiple time in the document, it violates the Html standard.

Using Javascript to get an element by id does not work this way. Each div would require a unique id.

Somthing like cbfv_[user_id]_FieldId

This way it would be unique and programmatically accessible.

If I am wrong, what might be the case easily, I would need to know how to access a specific element in the document with Javascript.
Last edit: 9 years 9 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
9 years 9 months ago #257630 by krileon
Replied by krileon on topic Invalid Html?
The ID can not be changed without breaking existing jQuery bindings. A lot of this will improve when we refactor our entire fieldtype classes. Why are you substituting in the DIV HTML like that? I don't recommend that approach. You should substitute in the field without its outer HTML (e.g. [cb:userfield field="FIELD_NAME" /]) then supply any outer HTML you want. This gives you 100% customization over it. Layout already includes the outer HTML so you've double outer HTML surrounding a field, which doesn't make sense.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

  • KatoKalin
  • KatoKalin
  • OFFLINE
  • Posts: 265
  • Thanks: 11
  • Karma: -5
  • Add-ons
9 years 9 months ago - 9 years 9 months ago #257631 by KatoKalin
Replied by KatoKalin on topic Invalid Html?
I am not sure anymore why it needed to be like that.
I believe the reason was that this way I get both the title + the field value both with its own div id. This way I was able to alter the field value only with css. As far as I have seen there is no substition method to grab the title of a field and its value seperately.

While it worked well with css, it does not work the same way with Javascript as it is not unique.

I have found a solution so far to grab the required value by tag. But it is just a workaround.

Edit: Also it seems that there is no way to use substition to get the id of a field?
Edit2: Something like: [FIELD_NAME DATA=TITLE] or [FIELD_NAME DATA=PARAMS(PARAMS_NAME)] or [FIELD_NAME DATA=FIELDID]
Last edit: 9 years 9 months ago by KatoKalin.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
9 years 9 months ago #257647 by krileon
Replied by krileon on topic Invalid Html?
When you pull in the entire field DIV that's exactly what you get. You get its entire formatted row. The field substitution doesn't know it's a field substitution. What you're asking isn't doable without adding an unnecessary layer of complexity and breaking anything already depending on the current ids. It won't particular matter once we've refactored the field classes, but for now we're not going to add complexity to the field handler code then end up scrapping it entirely. So I completely agree that it needs to be better, but it's just not the right time to implement such a thing.

As far as I have seen there is no substition method to grab the title of a field and its value seperately.

This is something we can more likely add as it's just another substitution instead of adding complexity to the field handler class. I've added a feature ticket for further review and implementation.

forge.joomlapolis.com/issues/5041


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

Moderators: beatnantkrileon
Powered by Kunena Forum