Closed (works as designed)
Project:
Webform
Version:
8.x-5.0-beta16
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Sep 2017 at 08:12 UTC
Updated:
10 Aug 2022 at 07:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jrockowitz commentedThe submit button is rendered within the webform-actions.html.twig template.
You can wrap any submit button by altering this template or using HOOK_preprocess_webform_actions()
You can also use
<a href="http://cgit.drupalcode.org/webform/tree/webform.api.php#n60">hook_webform_element_ELEMENT_TYPE_alter()</a>iehook_webform_element_webform_actions_alter()Comment #3
kay.beissert commentedThank you for the solution. That hints me to another way. In the webform-backend, I use the source-tab (yaml-editor) and add '#prefix' and '#suffix' for the actions like this:
jrockowitz, you are the greatest ;-)
Comment #4
scottsawyerStrange, when I add the #prefix, #suffix, it gets wrapped around the form-actions, but wrapped a second time around the submit button.
I am using Foundation as well. I have something like:
Which produces:
I am going to try the preprocess function.
Comment #5
scottsawyerNever mind, I was adding that to the actions container.
In my case, it made more sense to add those classes to the container anyway, which webform does very easily in the UI. I need to sleep...
EDIT:
This is actually a problem. I was able to work around it by putting two wrappers in the '#prefix' and '#suffix' in the preprocess function, but I feel like it's unexpected behavior when I add a #prefix and #suffix to the actions container and the output wraps not only the actions container, but the submit button as well, per my previous comment.
Comment #6
aaronbaumanI assume Bootstrap theme is interfering with the actions element, but does anyone know how to fix it?
I've added a custom class to my actions element, but it's ignored:
Comment #7
jrockowitz commentedThe attached webform shows that the issue is not Bootstrap specific. I will look into a solution.
Comment #8
aaronbaumanYeah, no this actually appears to be a bug.
Will file a new issue.
Comment #9
aaronbaumanoh, sorry didn't mean to cross-post and change status.
resetting to NW, but i can file a new issue if you want.
FWIW: I've found that the #wrapper_attributes property of actions is ignored, but the #attributes property works to apply a class to the wrapper.
Comment #10
jrockowitz commentedSince the submit buttons are a simple element you can just us #attributes.
The below code works with the Bootstrap theme.
Comment #11
aaronbaumanConfirming that #attributes works.
Should "wrapper attributes" be hidden from the UI, since it gets ignored?
Comment #12
jrockowitz commented@aaronbauman You found a feature/behavior of the edit element form.
If a property is specified via source, the UI inputs on the edit element form will always be displayed.
If you create a submit buttons element via the UI, the #wrapper_attributes are not visible.
Comment #13
aaronbaumanOK, that makes sense.
I can confirm after removing the #wrapper_attributes from source, the UI no longer appears
Thanks for clarifying, and thanks for the quick reply!
Comment #14
themasoodahmad commentedHey!
Can we change the
<input type="submit" value="Submit"/>to<button type="submit"><i class="fa-solid fa-arrow-right"></i></button>?