Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions css/_single_theme.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@
?>

.<?php echo esc_html( $style_class ); ?>.frm_inline_top .frm_submit::before,
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_inline_submit::before {
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_inline_submit::before,
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_aligned_submit::before {
content:"before";
<?php if ( ! empty( $font ) ) { ?>
font-family:<?php FrmAppHelper::kses_echo( $font ); ?>;
Expand All @@ -331,7 +332,9 @@
.<?php echo esc_html( $style_class ); ?>.frm_inline_form .frm_submit input,
.<?php echo esc_html( $style_class ); ?>.frm_inline_form .frm_submit button,
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_inline_submit input,
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_inline_submit button {
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_inline_submit button,
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_aligned_submit input,
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_aligned_submit button {
margin: 0 !important;
}

Expand Down
23 changes: 23 additions & 0 deletions js/formidable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,27 @@ function frmFrontFormJS() {
}
}

/**
* Detects inline submit buttons by comparing vertical position with the previous sibling field.
* Adds 'frm_aligned_submit' class when the submit button shares the same row as its sibling.
*
* @since 6.26
*
* @returns {void}
*/
function maybeMarkInlineSubmit() {
document.querySelectorAll( '.frm-show-form .frm_submit' ).forEach( function( submitContainer ) {
const previousSibling = submitContainer.previousElementSibling;
if ( ! previousSibling ) {
return;
}

if ( submitContainer.offsetTop === previousSibling.offsetTop ) {
submitContainer.classList.add( 'frm_aligned_submit' );
}
});
}

return {
init() {
jQuery( document ).off( 'submit.formidable', '.frm-show-form' );
Expand Down Expand Up @@ -1786,6 +1807,8 @@ function frmFrontFormJS() {
'frmPageChanged',
destroyhCaptcha
);

maybeMarkInlineSubmit();
},

getFieldId,
Expand Down