Comments (7)
I assumed I'd be able to do something similar and the jquery validation would handle the rest
'validation_rules' => ['required' => true], 'validation_messages' => ['required' => 'its required sorry']
This doesn't seem to work and there's not really much documentation as to the format / how this should work.
I tried the same approach and it ended up working out:
'url' => new \Fieldmanager_Link( 'Destination URL', [
'description' => 'All messages are linked to a destination page',
'validation_rules' => [
'required' => true,
'url' => true,
],
'validation_messages' => [
'required' => 'Required',
'url' => 'This is not a URL!',
],
'attributes' => [
'placeholder' => 'https://',
],
] ),
from wordpress-fieldmanager.
We've already integrated jQuery Validation and you can see the general description of how it works in the comments here: https://github.com/alleyinteractive/wordpress-fieldmanager/blob/master/php/class-fieldmanager-field.php#L131-L153
from wordpress-fieldmanager.
I think a working example in the demo
would fit well for this feature.
from wordpress-fieldmanager.
I think ultimately we should be able to PHP-require some fields and allow custom validation callbacks.
from wordpress-fieldmanager.
I'd also appreciate a working example of this.
from wordpress-fieldmanager.
I'd appreciate a working example of this also. The documentation here isn't very helpful: http://api.fieldmanager.org/class-Fieldmanager_Field.html#$validation_rules
I assumed I'd be able to do something similar and the jquery validation would handle the rest
'validation_rules' => ['required' => true], 'validation_messages' => ['required' => 'its required sorry']
This doesn't seem to work and there's not really much documentation as to the format / how this should work.
from wordpress-fieldmanager.
Came looking for an example but then found in the Fieldmanager_Field class that you want to pass it in as an attribute, which will add the HTML5 required attribute to the field. If it helps, there's an example at http://api.fieldmanager.org/class-Fieldmanager_Field.html#$attributes
from wordpress-fieldmanager.
Related Issues (20)
- Improve escaping of validation JS
- Autocomplete validation doesn't work HOT 1
- jQuery Validator issues with repeaters HOT 1
- Yoast SEO Compatibility Issue HOT 2
- Fieldmanager_Radios used as conditional source don't work if validation fails HOT 1
- Conditional visibility but unconditional validation HOT 4
- Hash Fieldmanager_Password values? HOT 2
- UI Issues HOT 3
- Admin menu page stopped working after PHP 8.0 update HOT 2
- Prevent saving values when they are the default value
- Using an image as a Fieldmanager_Radios label HOT 2
- Data not saving if FieldManager enabled in conditional check
- Repeatable fields with nested FM Groups prevent proper saving HOT 1
- Modifying values before save HOT 1
- MenuItem Fields: FM field styling blocks editing the menu item's label
- Custom attachment meta fields not displaying when new image is uploaded HOT 2
- Test suite needs to be updated HOT 1
- TextArea and RichTextArea fields cause a warning in PHP 8.1 HOT 1
- PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated HOT 1
- Resolve PHP Deprecations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wordpress-fieldmanager.