Comments (24)
This is indeed essential and valid.
from android-saripaar.
would be great if added this feature, plus one.
from android-saripaar.
A
from android-saripaar.
N
from android-saripaar.
Y
from android-saripaar.
Does anyone know if that fixes? Any way to add custom rules prioritizing
from android-saripaar.
@ceokin I am working on Saripaar v2, this and a lot of other issues will be addressed in the upcoming version. Plus a lot of new features :)
from android-saripaar.
If this is any help, for everyone that wants custom rules ordering, a quick fix would be to define a rule using a Regex.
from android-saripaar.
ragunathjawahar: I think the library is very good. I would like to know when you are going to update the library. Thank you.
from android-saripaar.
@ceokin I am experimenting with a few API designs, should be up in a week or two.
from android-saripaar.
@ragunathjawahar Thank you! I'll be waiting
from android-saripaar.
Thanks eagerly awaiting !!
from android-saripaar.
@almozavr @lwloon @raghunathj @ceokin @FabianShallari @jhonvidal Available in v2. Check out the v2 branch.
from android-saripaar.
Hi,
it`s possible to define the validation order with v2? If yes, how?
from android-saripaar.
@gmarques33, Just add the @Order
annotation on all your views and add a quick rule to a view
using validator.put(View, QuickRule...)
from android-saripaar.
before : validator.put(editText, Rules.required(Messages.ES_REQUERID_FIELD, true));
after : validator.put(View, QuickRule...) ??? :|
from android-saripaar.
public class V_RadioGroupButton extends Rule {
/**
* Creates a new validation Rule.
*
* @param failureMessage The failure message associated with the Rule.
*/
public V_RadioGroupButton(String failureMessage) {
super(failureMessage);
}
@Override
public boolean isValid(RadioGroup view) {
view.setBackgroundColor(Color.WHITE);
return view.getCheckedRadioButtonId() > 0;
}
}
How to QuickRule? :( documentation please
from android-saripaar.
@jhonvidal You need to use v2 of the library to use ordering with QuickRule
s.
from android-saripaar.
Thanks for responding, I'm using the v2, the problem is how to interpret the rules programming code
from android-saripaar.
@NotEmpty(sequence = 1)
@Email(sequence = 2)
// We are going to add a new QuickRule with a sequence number '3'
@Order(1)
private EditText mEmailEditText;
@Password
@Order(2)
private EditText mPassword;
@ConfirmPassword
@Order(3)
private EditText mConfirmPassword;
// ----------------------------------------------------------------------------------------------------------
// Possibly inside your onCreate(Bundle) method....
validator.put(mEmailEditText, new AllowMyDomainOnlyQuickRule(3));
// ----------------------------------------------------------------------------------------------------------
// This is your quick rule, you can also instantiate an anonymous one
static class AllowMyDomainOnlyQuickRule extends QuickRule {
// Code ...
}
Please check this comment for a complete idea. Ordering and sequenceing is different in v2 from v1's order
attribute.
from android-saripaar.
Great help, thank you very much !!! @ragunathjawahar
from android-saripaar.
@jhonvidal You're welcome :)
from android-saripaar.
a detail :
these lines :
@notempty(sequence = 1)
@Email(sequence = 2)
@order(1)
private EditText mEmailEditText;
How is interpreted programming in code? please an example of native rules
example in V1 :
validator.put(editText, Rules.checked(Messages.ES_REQUERID_FIELD, true));
in V2 : Rules.checked ???
EditText editText = new EditText(this);
..............
:) Thank
from android-saripaar.
I did this for required field :
public class AllowRequiredQuickRule extends QuickRule {
private static AllowRequiredQuickRule instance = null;
public static AllowRequiredQuickRule getInstance(int i) {
if (instance == null) {
instance = new AllowRequiredQuickRule(i);
}
return instance;
}
public AllowRequiredQuickRule(int i) {
super(i);
}
@Override
public boolean isValid(View view) {
return false;
}
@Override
public boolean isValid(Object o) {
EditText editText = (EditText) o;
return !editText.getText().toString().isEmpty();
}
@Override
public String getMessage(Context context) {
return Messages.ES_REQUERID_FIELD;
}
}
👍
from android-saripaar.
Related Issues (20)
- about Password Scheme
- Min/Max value check HOT 2
- Email rule is missing some constraints HOT 2
- @Optional
- definitely fail CI test HOT 1
- SaripaarViolationException HOT 2
- When validating Digits, some locales will fail Regex
- Provide support for the latest API level
- 在debug正常,然而在正式版本,就出现以下错误,请帮忙看看,谢谢
- 在debug正常,然而在正式版本,就出现以下错误,请帮忙看看,谢谢!
- Can't validate empty textview after fetch contacts data
- optional
- Support multiple module project HOT 2
- Is this project outdated? Can't find any documentation to implement?
- how to make custom error message layout?
- How to use android saripaar within fragment(androidx) for form validation?
- why the wiki doesn't work ?
- ##How can i add custom annotation to your library.
- can I change error color appears on edittext ? HOT 2
- I have problem with email sentence like "[email protected]", in there i cant validation sentence like "firstname.lastname" because [.] dotted center.
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 android-saripaar.