Second label of an input element comes with white-space and double quotes

cyberholic

Member
At the moment i am working on my own cusstom form.
For this i followed the tutorial in here on how to add individual elements within said form.
My code looks like this:
PHP:
$this->element =& $this->groups['User Settings']->elements['activationtime'];
//echo $this->loadTemplate('element');
echo $this->element->label;
echo $this->element->element;
echo "<hr>"
$this->element =& $this->groups['User Settings']->elements['activationtime'];
//echo $this->loadTemplate('element');
echo $this->element->label;
echo $this->element->element;

Problem:
The label of the first element is shown correctly.
The label of the second element ignores the css-styles and the Chrome-console shows me this:
HTML:
"
            Activation time
"
There are two Double Quotes and a lot of whitespace.

Recreation of what might be a reason for this error:
- I created an input field element for my form
- I saved and checked it: everything was fine
- I went to my Joomla backend and changed this field from input to dropdown
- I saved this element

Since then the element ignores the css set up for labels.

Greetings and thanks for your time!
 
I can't really help with custom templates in Community support.

That said, are you literally trying to render the same element twice? That would produce two DOM inputs with the same names and IDs, which won't work.

-- hugh
 
I restarted the whole design process again and it works.
But if you find the time, could you please test this out:
1. Create an input field for a form
2. In the options tab set it to hidden
3. Save it
4. Open that just created input field and switch its type to dropdown
5. Add two options and Save

Result: with me the newly created element keeps the class "fabrikhide" thus the dropdown does not show up.
In short: Before switching a hidden input field to a dropdown, you have to unhide it or the "fabrikhide" class will be used though you can not set up the hidden option once you are the setup for a dropdown.

That's at least what happend to me.
Sorry for my english, if you want to, i can make a video of this.

Greetings and thanks a lot for your time!
 
This is a known effect.
If you are switching elements types or change field formatting you must know what you are doing.
It may change the DB table structure, create new (repeat) tables, you may lose data...
 
In short: Before switching a hidden input field to a dropdown, you have to unhide it or the "fabrikhide" class will be used though you can not set up the hidden option once you are the setup for a dropdown.

Yes, this is known behavior. Not all elements have a visible "hidden" setting in their params, as it doesn't really make sense hiding an actual UI object like a checkbox or a dropdown, because when you set "hidden" we no longer render them as such, we just add a type="hidden" input with a value, no UI rendering. So there's kind of no point in designating something a dropdown and then setting it to hidden. Typically the only things you want to hide are simple fields.

However, all elements share the same basic parameters. So just because you don't see a param in the visible options doesn't mean it's not there. So for things like dropdowns, the "hidden" param is still there, it's just set to false and you can't see it in the visible settings.

And this is how you can actually hide an element that doesn't have that option visible. Change it to a field, set hidden, save it, change it back to whatever element type it was, save it.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top