UPDATE: Tried it by modifying includes/shortcodes.php
It breaks existing forms by showing the label underneath the input… (I should have thought of that), which can be mitigated by CSS
Something like:
.pt-form-group {
display: flex;
flex-direction: column-reverse;
}
-
This reply was modified 6 years, 2 months ago by
rkuipers33.
Thanks for your message. I’m very reluctant to change the HTML now, as thousands of users already have custom css based on the current structure. So it will be some more work to have a UI or something to select between old and new structure. But that’s for the future.
Check the changelog, in the recent version I added “Fields: add “class”…”. Maybe you can use that?
https://wordpress.org/plugins/paytium/#developers
David, you’re right, that is an important consideration.
The extra class on fields do not solve the problem (problem is too big a word) of not being able to use things like input::focus label { color: blue; } in CSS, I’m afraid.
After some thought I came up with this: I wrapped just the input and label (in that order) in a new <div class="pt-field-group">
To make the Parsley errors not interfere with the label styling, I added an id to the div, like <div class="pt-field-group" id="pt-field-group-firstname-2"> (example)
and used that in the corresponding field by adding data-parsley-errors-container="#pt-field-group-firstname-2" .
Putting an extra div-wrapper in between does not break anyone’s CSS.
And I suppose nobody is relying upon the label being before the input in HTML.
Adding the following CSS in /paytium/public/css/public.css makes things look just like before:
.pt-field-group {
display: flex;
flex-direction: column-reverse;
}
I did some extra styling in my theme after that and it is soooh easy to make it look (even) great(er) now!
Hope you will reconsider and I’ll be glad to further elaborate if helpful.
Thanks,
Rob
Thanks, I’ll keep this in mind.
I’m so enthusiastic about this, I needed to share a bit…
Just to get a feel of the possibilities of things like:
.pt-field-group input:required + label::after,
.pt-field-group select:required + label::after {
content: " (required)";
}
.pt-field-group input:focus + label,
.pt-field-group select:focus + label {
color: #2b96f1;
}
.pt-field-group .parsley-error:focus + label {
color: #a94442;
}
See https://codepen.io/rkuipers/pen/vYOeNvV
The effect shown here should be possible too, by defining a placeholder containing a single space, using .pt-field-group input:placeholder-shown + label and .pt-field-group input:not(:placeholder-shown) + label !
I’ll stop now 😉
Cheers, Rob