Submit Button Issue
Support › MB Frontend Submission › Submit Button Issue
- This topic has 13 replies, 2 voices, and was last updated 1 year, 5 months ago by
Peter.
-
AuthorPosts
-
August 8, 2023 at 1:51 AM #42836
Piotr
ParticipantHello,
I noticed that usually I have to click twice on the submit button to trigger form submission.
Additionally, in some browsers (e.g., Firefox), submit buton doesn't work at all.August 8, 2023 at 9:28 PM #42845Peter
ModeratorHello,
Please share the page that has the frontend submission form on your site, I will take a closer look.
Besides that, do you use any custom code to customize the form? You can try to create a new page and put the simple shortcode to the page content
[mb_frontend_form post_fields='title,content']
and recheck the issue on this page.August 9, 2023 at 8:57 PM #42861Piotr
ParticipantHi, I am not able to share the website, which is offline.
I create the form with:
[mb_frontend_form id="field_group_1,field_group_2,field_group_3" edit="true" post_fields="" post_type="custom_post_type" submit_button="Save"]
Then each field group is made with
rwmb_meta_boxes
filter.I noticed the issue exists when I edit existing post. Empty form triggers submission without the issue.
August 10, 2023 at 8:16 PM #42875Peter
ModeratorHello,
I do not see that issue on my local site, here is the screen record https://imgur.com/4tzmIvH
After the first submit click, the post is created as well. The form is still displayed because the attribute
edit
is set totrue
.August 17, 2023 at 2:20 AM #42941Piotr
ParticipantI tried to disable other plugins and switch to default theme, but no change.
I also checked for any errors on form submission, but receiving no errors.
Currently I use tabs to preset fields, I tried to check for issues with tabs disabled, but still the problem exists.August 17, 2023 at 8:42 PM #42948Piotr
ParticipantOkay, I think I have found the reason why the form submission isn't triggered as expected.
It's thevalidation
part of themeta_boxes
array. Removingvalidation
key restored normal form submission. I haven't yet made any further tests, but at least there's a starting point, and maybe it might help you pointing out a solution? I will carry on checking it anyway.August 17, 2023 at 10:24 PM #42958Piotr
ParticipantDigging deeper and I could narrow down the issue reason to the
remote
parameter of therules
key.Next, different browsers behave different way, depending on how many rules within
validation
key haveremote
parameter set up:1. In Brave: When I have only single field with
validation
>rules
>field_name
>remote
set to something like'remote' => admin_url( 'admin-ajax.php?action=h29dk' )
the form works. However, adding second remote rule for another field (with different action name) causes the issue with the form submission. Two rules, one with remote parameter and one without, don't cause the issue.2. Firefox: The issue exists already with only single rule with
remote
parameter.Would be grateful for further tips on how this could be fixed in order to keep remote validation.
August 17, 2023 at 11:02 PM #42960Peter
ModeratorHello,
So please share the PHP code that creates the meta box on your site. I will check it on my demo site.
August 18, 2023 at 12:22 AM #42961Piotr
ParticipantNow, the problem seems to be with the callback to the ajax request.
I have the following callback function set in
'remote' => admin_url( 'admin-ajax.php?action=test_request' )
:function test_function() { $title = $_GET['post_title']; if ( 65 >= mb_strlen( $title, 'UTF-8' ) ) { echo 'true'; } else { echo 'false'; } die; } add_action( 'wp_ajax_test_request', 'test_function' );
Testing it in Firefox gives the following results:
1. When I edit the post and click on Save without clicking inside any text fields the form submission doesn't trigger.
2. When I edit the post and before I click Save I click inside the title field (this field undergoes above validation), the form triggers submission. The title's validation works upon clicking inside the filed as expected (if the title is longer than 65 characters the validation fails, otherwise, the field is valid and the error message disappears).If you still prefer to have the code I use to create the metabox, can we share it securely?
August 19, 2023 at 7:23 PM #42986Peter
ModeratorHello,
On my demo site, with Firefox, I need to click Submit button twice in order to submit the post and the validation also does not work. But it works properly when testing with Chrome.
I'm escalating this issue to the development team to check this.Thanks for your details.
August 19, 2023 at 8:37 PM #42988Piotr
ParticipantThanks, hopefully this can be fixed.
Indeed Chrome seems to handle form submission with fewer problems than Brave and Firefox, according to the users of my website who were testing it in this browser, but Brave and Firefox also show differences in this matter.
Looking forward to hearing from you.
September 13, 2023 at 12:28 AM #43230Piotr
ParticipantHi, any chance this issue can be solved soon?
November 22, 2023 at 6:20 PM #43879Piotr
ParticipantHello guys, will the issue be addressed at all, or we should seek another solution?
November 23, 2023 at 8:31 PM #43897Peter
ModeratorHello,
The development team is checking the issue. I will get back to you soon.
-
AuthorPosts
- You must be logged in to reply to this topic.