• Resolved gerobe

    (@gerobe)


    I recently encountered a JavaScript error when submitting cforms forms with AJAX enabled:

    javascript

    Uncaught TypeError: Cannot read properties of null (reading 'value')

    As a result, AJAX stopped working and the page reloaded after submission.

    In the HTML source, the hidden field cf_working was rendered incorrectly:

    <input type="hidden" id="cf_workingXX" value="<span>Please wait...</span>„/>

    Cause:
    In the lib_render.php file, cforms incorrectly adds a <span> inside the value attribute of hidden fields.

    Solution:
    In lib_render.php, adjust the following line:

    Before:

    value="<span>' . TEXT . '</span>"

    After:

    value="' . TEXT . '"

    Remove the <span> from both cf_working and cf_failure fields.

    After this fix, AJAX works properly again.

    Note:
    This change will be overwritten by future plugin updates.

    Hope this helps others facing the same issue!

    Tested with WordPress 6.x, PHP 8.x, cforms 15.0.7

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author bgermann

    (@bgermann)

    Thanks for the report. Fixed with 15.0.8.

    Thread Starter gerobe

    (@gerobe)

    Thank you for implementing this solution into the official version so fast!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘AJAX error due to in hidden field – Solution’ is closed to new replies.