I have a View that displays the child CPT Replies of a Post.
Post
> Reply 1
> Reply 2
> Reply 3
For each Reply, I have inserted the same Reply form, that creates a Reply to the original Post.
Post
> Reply 1
>> Reply Form
> Reply 2
>> Reply Form
> Reply 3
>> Reply Form
If I use AJAX to submit the Reply Form, it only submits for Reply 1 and not Reply 2 or Reply 3.
If I do not use AJAX it works fine.
I have checked the CRED form IDs in the output and they are all unique.
Minesh
Supporter
Sprachen:
Englisch (English )
Zeitzone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
There is no such feature available but you maybe workaround this by adding some custom code.
Here is the related ticket that might help you and you will get the idea and you may need to adjust the code as required:
=> https://toolset.com/forums/topic/submit-multiple-forms-at-once/#post-2111533
For example:
jQuery( document ).ready( function($){
$("#mybutton").click( function( event ){
$("table .wpt-form-submit").each(function(i){
var $this = this;
setTimeout(function(){ $($this).click() }, i * 1000)
});
});
});
Hi Minesh
Thanks. I am not trying to submit more than one form at the same time, just any of the single Reply Forms.
I can submit the Reply Form for Item 1 on its own and it works correctly, the page reloads and the Reply is visible, but when I click submit on the Reply Form for Item 2, Item 3, or Item n, it 'looks' as if it is working, the page reloads, but the Reply CPT is not created.
It is strange that it works for the first form and not the others.
Gavin
Here is a link to a screen recording:
versteckter Link
I should point out there are no JavaScript errors in the console that could be preventing the AJAX form submission from working.
Getting closer...
When I removed the content field code (as follows) from the reply in the form, it worked!
<!-- Content -->
[cred_generic_field type='textarea' field='post_content' placeholder="Post a reply..."]
{
"required":0,
"default":"[wpv-post-body template='None']",
"persist":1
}
[/cred_generic_field]
I replaced this content code with:
[cred_generic_field field='post_content' type='textarea' class='' urlparam='' placeholder="Post a reply..."]
{
"required":1,
"validate_format":0,
"default":""
}
[/cred_generic_field]
Not sure how I had got the persist:1 in the original code... weird... but I guess that was what was killing the forms from working.