Skip to content

FieldtypeComments: default action URL incorrect if template trailing slash setting is "No" #866

@Toutouwai

Description

@Toutouwai

Short description of the issue

The default action URL defined in CommentForm.php is './', but if the template setting "Should page URLs end with a slash?" is "No" then the comment form submits to the parent page.

Although a custom action can be supplied to renderForm() in the $options array it may not be obvious that this is necessary or what is causing the comment form to submit to the wrong URL.

Related forum topic: https://processwire.com/talk/topic/21427-comments-not-saving/

Suggestion for a possible fix

Set the action to the current page URL in the CommentForm constructor.

At line 80:

'action' => '', 

At line 164:

// default action
$this->options['attrs']['action'] = $this->wire('page')->url;

Setup/Environment

  • ProcessWire version: 3.0.130

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions