Ticket #2213 (new enhancement)

Opened 11 months ago

Add Validator to CMS EditForms

Reported by: ischommer Owned by: aoneil
Priority: minor Milestone:
Component: CMS - General Version:
Severity: high effort / impact Keywords: tricky
Cc: sminnee Hours:

Description

Currently we can't validate fields entered in a CMS-form (getCMSFields() on SiteTree? or subclasses). While CMS-admins should be able to edit/delete fields as they please, sometimes its handy to have validation (e.g. to check for wrong date-formatting).

as fields are loaded by ajax, we can't rely on the validator-js being loaded in the html-header. easy solution would be to disable clientside validation within the CMS. better solution is to refactor the js-validation and form-ajax-loading to be applied by behaviour (and proper onsubmit-handlers).

some initial steps:

  • add getCMSValidator() to SiteTree?
  • hook into CMSMain->EditForm?()
  • (optional) make sure that validator-subclasses get merged instead of replaced (e.g. appending required fields)
Note: See TracTickets for help on using tickets.