Incorrect detail.contactFormId Value in Contact Form 7 JavaScript API
-
The
_wpcf7
hidden field value is being incorrectly set to the page ID minus one instead of the Contact Form 7 form ID. However, the_wpcf7_container_post
field is correctly set to the page ID. This inconsistency may cause functionality issues as the_wpcf7
field should reflect the Contact Form 7 form ID.Steps to Reproduce:
- Create a new Contact Form 7 form.
- Add the form’s shortcode to a page and save it.
- View the page in a browser.
- Inspect the source code of the page.
- Search for the
_wpcf7
hidden field in the form.
Expected Behavior:
The_wpcf7
hidden field should have the value of the Contact Form 7 form ID – in my test case’ f7e1d90′.Observed Behavior:
The_wpcf7
hidden field is set to the page ID minus one instead of the Contact Form 7 form ID.
The_wpcf7_container_post
field is correctly set to the page ID.
When programmatically accessingdetail.contactFormId
in JavaScript, the value retrieved does not correctly match the actual Contact Form 7 form ID. This discrepancy is causing functionality issues.Environment Details:
- WordPress Version: 6.7.1
- PHP Version: 8.2.26
- Contact Form 7 Version: Version 6.0.1
- Browser: Chrome Latest
Additional Information:
This behavior is reproducible across multiple pages and forms. Correcting this issue will ensure that the_wpcf7
field value aligns with the expected Contact Form 7 form ID.
This behavour is described in https://contactform7.com/dom-events/
- You must be logged in to reply to this topic.