Forum Replies Created

Viewing 15 replies - 1 through 15 (of 91 total)
  • Thread Starter Rick Curran

    (@rickcurran)

    I do understand that it’s not a bug as such in Contact Form 7, it’s just that there is some odd behaviour happening which was causing an extra rule to appear in the schema.

    In a working form a required file field adds a requiredfile rule in the schema, but for some reason I was getting a required rule in the schema too, which when it existed then caused the JavaScript trim error I was seeing in the console.

    I do now have a correctly functioning form as the required rule is no longer appearing in the schema. But the bit I can’t figure out is why this required rule was getting added, based on all of the testing I have done such as disabling plugins and switching themes it does appear to be triggered by some code in my theme but it’s just not clear what exactly that was. In the end I have actually changed nothing and neither removed or edited any of my code and the issue has suddenly just gone away, so it is a little concerning situation. I will just have to monitor it and hopefully the issue will not reappear.

    One final question if that’s ok, I’d asked this above but it would be useful to know for my own better understanding: Can you clarify how the SWV schema is updated? Is it modified whenever a Contact Form entry is updated or does the Schema generate when the Contact Form is loaded in the page of the site?

    Thank you again for taking the time to respond, it is much appreciated!

    Thread Starter Rick Curran

    (@rickcurran)

    Thanks for looking at this further. I do agree that all the signs point to it being something within my theme, however I just can’t get to the bottom of what could be the cause.

    Today I did some further tests which have made it even more confusing, I have taken a further look at it and I purposely disabled some other JavaScript and PHP includes on the site that relate to forms to see if they were causing an issue. I then went through the form, selected a file with the file select and I got no JavaScript error, I then re-enabled all of the other JS and PHP includes and tried it again and now there is still no error(!).

    So unfortunately it really doesn’t make sense, the issue has disappeared but not in a way that I can pin down to any specific behaviour or repeatable action. I have on occasion had this issue before and it did seem to clear up by simply re-uploading the JavaScript file to the server, but on this occasion it has been a much bigger problem. Additionally I still do not encounter this issue on the Live version of the site which adds to the weirdness of this issue.

    Interestingly both SWV schemas now show identical when I compare the Staging and Live versions, so the stray additional “required” file field is no longer appearing in the Schema. Can you clarify how the SWV schema is updated? Is it modified whenever a Contact Form entry is updated in the system or does the Schema generate when the Contact Form is loaded in the page of the site? I’m just trying to gain a better understanding of processes are happening here, whilst this bug has gone for now I do think there is some underlying situation that is causing this to be a weird “heisenbug” type of issue.

    Rick Curran

    (@rickcurran)

    @westonruter I have had come across two sites so far that I’ve built that have issues since 6.9, neither use Elementor, both were affected quite badly so I have had to revert to WP 6.3. I am now going to review other sites I’ve developed and see if there are others affected.

    Thread Starter Rick Curran

    (@rickcurran)

    Yes, if I switch to the default theme the redundant required rule does not appear in the schema.

    Thread Starter Rick Curran

    (@rickcurran)

    @takayukister It is my own custom theme that I use to implement the JavaScript code.

    Thread Starter Rick Curran

    (@rickcurran)

    @takayukister The multi-step form functionality is my own code, it is basically some JavaScript code that handles the steps and does some of its own validation on the fields at each step by checking which fields are set as “required”. Generally I don’t rely on the default CF7 validation for these forms as the aim is to ensure everything is valid before the user proceeds to the next step and then to ultimately submit the form. In this case however it does seem to be the CF7 validation that is being triggered when the required file field is used. I am definitely happy to find an issue in my code which is causing or contributing to this error but so far I have not been able to. It’s the difference in behaviour between the Staging and Live versions of these sites / forms which is the key issue.

    Sorry, one thing I should have included before is a link to the Live version of this same form which doesn’t trigger the error so that you can compare. This is the most confusing aspect of this issue, why the error occurs on the Staging site but not on Live. Here is a link to the Live version (Note, please don’t submit the form on the Live version as this an active form, the key point to note is when you actually select a file with the file selector, on Staging you should see the JS error, on Live you should not):

    https://qreate.co.uk/cf7form-issue-live

    Can you comment on the differences in the SWV schemas that I highlighted in my original post, this does seem to be an important difference between the two forms. I have a few questions about the schema:

    • Does the SWV schema get updated when a form is saved?
    • And does this schema get affected by updates to the CF7 plugin itself?
    • Is the 4th ruleset I show in my original post an expected rule that should exist for forms with a “required” file field?
    • The contact form entry on the Live site has not been updated / saved recently, so if the SWV schema is affected by updates and saving I am wondering then will this SWV schema change to match what is happening on the Staging site?

    The last question above has been my main concern, at the moment the issue is only happening on Staging, but the form continues to work on the Live site. So I am concerned that updating / saving the form post on Live is going to introduce the same error.

    • This reply was modified 6 months, 1 week ago by Rick Curran. Reason: Fixed typos, grammatical changes
    Thread Starter Rick Curran

    (@rickcurran)

    @takayukister There are quite a number of other plugins in use on the site, some third-party and some specifically made for this site. I have tested by disabling all of them on the Staging version but the issue persists, so it doesn’t appear to be another plugin causing the issue. I also have the exact same set of plugins active on the Live site where the issue is not occurring.

    I know that testing the issue on a default theme is a common debugging scenario, I have also tried this, however, it is a little difficult to test as the theme for the site includes functionality specific for these forms. So I am still really trying to figure out why there is a difference between the behaviour on Staging and Live versions.

    Thread Starter Rick Curran

    (@rickcurran)

    If you step through that form you should see an error in the console when you select a file, if you go to the last step of the form, check the tick box and try to submit it will then come up with the “One or more fields have an error” message.

    Thread Starter Rick Curran

    (@rickcurran)

    @takayukister Thanks, the site is a dev site for a client, so it is publicly viewable, but in order to not leave a permanent link here I have set up a redirect via my own website that should take you to an example form showing the error:

    https://qreate.co.uk/cf7form-issue

    I will remove this redirect at a later date.

    Thread Starter Rick Curran

    (@rickcurran)

    Hi Andrew, I have contacted via the Help centre now.

    Thread Starter Rick Curran

    (@rickcurran)

    HI Andrew, thanks, I have tried making that change but I still get the fatal error when switching to Ukrainian.

    Thread Starter Rick Curran

    (@rickcurran)

    Hi Andrew, thanks for your reply. I’m not sure I understand the context of your reference to “Translate Post Tags only on the %sTags%s page“, I haven’t done any specific coding to implement this plugin, the process has been to install the plugin. The error causes a fatal error on both the frontend and backend admin, so I had to connect to the site via SFTP and remove the plugin from the plugins folder to be able to get in and log in to the site. As soon as I re-activated the plugin it cause the error again.

    However, I’ve managed to do a bit more debugging which may shed a bit more light. The site is using English and Ukrainian and I think the error is occurring when the site is switched to Ukrainian.

    I was able to determine this by rolling back to version 1.4.8 of the plugin which did not have the error occurring, with that version activated the site was running without error. I could see that the language switcher was set to Ukrainian (and could also confirm this as I the Multilanguage plugin settings in the WP Admin were also in Ukrainian). With version 1.4.8 activated I switched the language back to English and then updated the plugin to version 1.4.9 again, when running in English the site works fine but when I change to Ukrainian the error occurs and the site is down again.

    So it seems to be something about the Ukrainian translation that is triggering the error, and it is something that changed in version 1.4.9 that is causing this as with 1.4.8 it works without error.

    Let me know if there is anything else you need to know.

    Thanks again for your help!

    @inmoeduca I did have a problem with attachments not being sent, but in this case it turned out to be some other code I had in place which was affecting the posted data of the forms, so it doesn’t seem like an issue with the plugin itself. I was able to comment out the code causing the issue as it was no longer needed for the website. This code previously used to work, so something has changed either with WordPress itself or with this plugin, so at some point I may need to look into it further, but for now I have resolved my issue by removing the problematic code.

    In my case I used PHP error_log calls to take a look at the data being submitted to the form in order to see what was being submitted, so if you know your way around PHP a bit you could try something similar to see what is actually getting submitted in the form.

    @inmoeduca Sorry, is the issue that the attachment is not coming through with the email that’s being sent? If so I’m also trying to debug a similar issue so I was looking here in the forums to see if anyone else is having the same issue.

    Thanks!

    @saxpaolo In your function you get the array for form data using:

    $form_data = $submission->get_posted_data();

    But in then it looks like you’re trying to get the value of a text field in this line:

    $text = isset($data['contact-form--message']) ? $data['contact-form--message'] : "";

    Shouldn’t that be $form_data['contact-form--message'] rather than $data?

Viewing 15 replies - 1 through 15 (of 91 total)