-
Notifications
You must be signed in to change notification settings - Fork 823
Forms: Display success info after form submission without reload #44204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 6 files. Only the first 5 are listed here.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
*/ | ||
private static function render_ajax_success_wrapper( $form ) { | ||
$html = '<div class="contact-form-submission contact-form-ajax-submission" data-wp-class--is-submitted="state.hasSubmitted"'; | ||
$html .= '<p class="go-back-message"> <a class="link" href="#" data-wp-on--click="actions.goBack">' . esc_html__( 'Go back', 'jetpack-forms' ) . '</a> </p>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the CSS classes these for backwards compatibility, or would it make sense to add jetpack-
prefix to scope them better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are for backwards compatibility, yes. That is almost a copy of the current post-submission screen.
|
||
if ( 'message' === $form->get_attribute( 'customThankyou' ) ) { | ||
$raw_message = wpautop( $form->get_attribute( 'customThankyouMessage' ) ); | ||
// Add more allowed HTML elements for file download links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why be restrictive here at all instead of just using wp_kses()
's default restrictions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the current implementation on the post-submission screen. The idea is to match it as well as possible, so I copied it over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense then 👍
} else { | ||
$html .= '<template data-wp-each--submission="state.getSubmissionData"> | ||
<div class="field-name" data-wp-text="context.submission.label" data-wp-bind--hidden="!context.submission.label"></div> | ||
<div class="field-value" data-wp-text="context.submission.value"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as https://github.com/Automattic/jetpack/pull/44204/files#r2189419246 — any reason not to prefix class with jetpack-
? This one is particularly generic and can collide with theme/other plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can prefix them, yes. I just need to make sure the prefixed classes also work on the current screen. Will add it in this PR.
4318546
to
c0bf111
Compare
Part of FORMS-69
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
add_filter( 'jetpack_forms_enable_ajax_submission', '__return_true' );