Comments (12)
I don't get the feature u r trying to implement.
It's either
- user needs to fill field1 or field2
OR
user needs to fill field1 and field2
I also don't understand why the require check is an issue, please provide more details
from jquery-validation-engine.
Example 1 :
- field1 : ""
- field2 : ""
=> fail
Example 2 :
- field1 : "foobar"
- field2 : ""
=> success
Example 3 :
- field1 : ""
- field2 : "foobar"
=> success
Example 4 :
- field1 : "foobar"
- field2 : "foobar"
=> success
Same thing with 3, 4… fields.
This is a better example ?
from jquery-validation-engine.
Yes much better,
There is a sample called demoValidators.html which does a validation using a function.
You will need to define the validation rule on both of your fields, as such
class="validate[required,funcCall[checkFields]]"
then, create the method itself
function checkFields(field, rules, i, options){
// change this logic for your specific needs
if (field.val() != "HELLO") {
// this allows to use i18 for the error msgs
return options.allrules.validate2fields.alertText;
}
}
Note that in the function, you are free to add jquery lookups to find your fields. such as
jQuery("#myID"));
Hope this helps,
from jquery-validation-engine.
Your solution don't work, I've already tested.
in my fields, I put class="validate[funcCall[myfunc]]"
not "required" because all fields are not required.
Next if "myfunc" function return a string, option.isError is disable because there are
if(!required){
if(field.val() == "") options.isError = false;
}
in "_validateField" method.
You can do the test, your solution don't work.
Regards,
Stephane
from jquery-validation-engine.
ok I got it, try with "optional" instead of "required"
from jquery-validation-engine.
I didn't see "optional" option in source code, documentation or example.
It's new feature ?
from jquery-validation-engine.
you are right, it has been removed in 2.0
Could you plz send me a sample ?
from jquery-validation-engine.
You can download this example :
http://dl.stephane-klein.info/jQuery-Validation-Engine/demoValidators.html
At the bottom of page, there are "At least one field is required" fieldset.
from jquery-validation-engine.
I did a pull request to fix this request.
from jquery-validation-engine.
I'm having the same issue, is it still unresolved?
from jquery-validation-engine.
pull request has been merged, issue is resolved -> Closed status
from jquery-validation-engine.
Great :)
from jquery-validation-engine.
Related Issues (20)
- <input type="number" class="validate[custom[number]]"/>时,谷歌,火狐浏览器验证value为"1..55"这样的多个点时,验证失效,IE下验证OK HOT 2
- Vue.js conditional rendering HOT 1
- Add Issue template and Pull request template
- (hide) hiding all error prompts?! HOT 1
- [QUESTION] Where I can find the CI service? HOT 2
- Jquery validation engine not working with Jquery 3.4.1 HOT 4
- Starting pre release 3.0.0 HOT 2
- X-Requested-With: XMLHttpRequest is not transmit in v3.0 HOT 2
- is there a way to upload a file on the form ajax call ? HOT 4
- Support ipv6 in custom regex HOT 1
- cdn HOT 6
- Select Date & Validate
- Incompatible date format in some locales with 'future'
- Position Left issue
- GHSL-2020-354: seeking security contact for your project
- promptPosition dont work HOT 1
- Documentation
- Trying to get in touch regarding a security issue
- About Bug or duplicate Javascript code line HOT 1
- Can't show error message
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 jquery-validation-engine.