Skip to content

Cannot clear embedVideo field after it was set once #577

@keep

Description

@keep

Description:
If we fill the embedVideo field of an item once, it is impossible to clear it later.

Steps to reproduce:

  • Edit a K2 item and add any value to the embedVideo field.
  • Save the item.
  • Reopen the item, delete the content of the embedVideo textarea and save.
  • The previous video value returns – it cannot be cleared.

Technical details:
K2ModelItem has this logic:
`
if (JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW)) {
$row->video = JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW);
}

`
Because of the if condition, an empty string never reaches $row->video, so the field cannot be reset.

Expected behavior:
If the user clears the field, the value in the database should also be cleared.

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