Jump to content

FrontendForms - A module for creating and validating forms on the frontend


Juergen

Recommended Posts

Here is my ouput from the source code:

<div class="uk-margin uk-grid-small error uk-grid" data-uk-grid="data-uk-grid" id="test-checkbox-fieldwrapper">
  <div class="uk-width-auto uk-first-column">
    <input id="test-checkbox" name="test-checkbox" type="checkbox" class="uk-checkbox uk-form-danger" required="" aria-invalid="true" aria-           errormessage="test-checkbox-errormsg">
  </div>
  <div class="uk-width-expand">
    <label class="uk-form-label required" for="test-checkbox">My Checkbox Label<span class="asterisk">*</span></label>
  </div>
  <p class="uk-text-danger uk-width-1-1 uk-grid-margin uk-first-column" id="test-checkbox-errormsg">My custom required text</p>
</div>

As you can see the class "uk-width-1-1" is set on the error text.

Link to comment
Share on other sites

  On 3/23/2025 at 6:57 PM, PWaddict said:

Maybe the module still having issues with the namespace?

Expand  

No, this could not be a reason, because you are also using these lines of code to manipulate the classes:

$checkbox->getFieldWrapper()->setAttributes(['data-uk-grid', 'class' => 'uk-grid-small']);
$checkbox->getLabel()->wrap()->setAttribute('class', 'uk-width-expand');

This methods are working in the same way as the getErrorMessage() method.

I cannot tell you, why getFieldWrapper() and getLabel() works, but getErrorMessage() not. As written before, in my case everything works as expected.

If you cannot find the cause, please use the hook method to get your desired result.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...