Questions tagged [validation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6
votes
1answer
1k views

How can I add custom validation rules to my plugin settings?

I have a plugin that needs to perform some custom validation on one of its settings. How would I go about doing that?
6
votes
3answers
3k views

Programmatically update entry field

I'm trying to update an entry's field value from a Craft plugin. First I was trying to just update the attributes of the entry like so: $entry->getContent()->setAttributes(array( 'metaStatus' ...
3
votes
1answer
352 views

How can I repopulate a matrix field on a front-end form?

I have a matrix field on my front-end form. Everything is working properly, data is saved correctly etc. I am testing & trying to break things and I noticed I wasn't repopulating those fields if ...
3
votes
1answer
447 views

Craft Commerce: Custom address model validations

How/Where/Can I add more address model validations than just "firstName" and "lastName"...?
2
votes
1answer
384 views

Title field character length

Is it possible to limit the title field in an entry? As with other fields I can adjust so that it only takes a certain amount of characters.
2
votes
1answer
210 views

Repopulate dateTime field in plugin settings page

In my plugin settings page, I have a startDate input which is a dateTime field. _settings.html {{ forms.dateField({ 'label': 'Start Date'|t, 'instructions': 'Choose a date'|t, 'id'...
0
votes
1answer
320 views

defineAttributes and rules

Using this fantastic article on validation, I have written a custom validator class. Everything is working, but I'm curious about the rules and defineAttributes method(s). Most likely I'm just ...