Skip to content

Using url_title parameter with Channel Form does not persist form data with inline error handling #4504

@nerdgency

Description

@nerdgency

Description of the problem
When using Channel Form, I've encountered an issue when using error_handling="inline" and url_title="" where after form submission with a field validation error, the posted data is not returned back to the form as and old value.

If I use entry_id="" instead, the form submits correctly, the validation error appears, and the old value remains in the input field.

How To Reproduce
Steps to reproduce the behaviour:

  1. Create a channel with a custom text field
  2. In a template, use the template tag below and set the rules only so that the form validation is triggered and the form doesn't actually succeed and submit the changes.
  3. Complete the form to force the validation error (in my example, I tested it using the required and numeric validations and then submitted text only)
  4. Click submit
  5. The form error shows, but the field value is blank instead of the text entered

Using url_title does not work

{exp:channel:form
    url_title="playground"
    channel="sandbox"
    error_handling="inline"
    rules:basic_input="required|numeric"}
        
    <input type="text" name="basic_input" value="{basic_input}" />
        
    {if error:basic_input}
        {error:basic_input}
    {/if}
        
    <button type="submit">Submit</button>
{/exp:channel:form}

Using entry_id does work

{exp:channel:form
    entry_id="1"
    channel="sandbox"
    error_handling="inline"
    rules:basic_input="required|numeric"}
        
    <input type="text" name="basic_input" value="{basic_input}" />
        
    {if error:basic_input}
        {error:basic_input}
    {/if}
        
    <button type="submit">Submit</button>
{/exp:channel:form}

Environment Details:

  • EE Version 7.4.11
  • PHP Version 8.2.15
  • MySQL Version 8.0.27
  • OS: Mac OS Sonoma
  • Web Server: nginx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions