Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic validation #116

Closed
ronakamlani opened this issue Oct 7, 2015 · 9 comments
Closed

Dynamic validation #116

ronakamlani opened this issue Oct 7, 2015 · 9 comments

Comments

@ronakamlani
Copy link

Hello, first of all thank you so much such perfect library.

I am new with your library I have conditional based some field, can I validate that as well ? if yes then how.

Thanks,
Ronak Amlani

@ragunathjawahar
Copy link
Owner

Thank you Ronak. Can you give me an example?

@ronakamlani
Copy link
Author

Definitely my friend,

Its not bug, I do not know the way to achieve..

Check below code and comment....

@NotEmpty
private EditText etQrcodeName;

@NotEmpty
private EditText etStartDate;

@NotEmpty
private EditText etEndDate;

//Configuration
private Spinner spQrcodeType;

@NotEmpty
private EditText etQrcodeData;


/******************************************************************/
//I am looking for validate to all but all below given section are condition based, that means either Data section
// Or Access location section need to validate not both, this decision will taken runTime depend on one dropdown parameter.


//Data section.. 
private Button btnAccessLocation;
private int lat;
private int lng;

//Access location section..
private Spinner spAccessGroup;

private EditText etWebsiteName;
private EditText etWebsiteUrl;

private EditText etOpeningTIme;
private EditText etClosingTIme;



@Override
public void onValidationSucceeded() {

    //Get data from server..
    saveParticipate();

}

@Override
public void onValidationFailed(List<ValidationError> errors) {
    for (ValidationError error : errors) {
        View view = error.getView();
        String message = error.getCollatedErrorMessage(this);

        // Display error messages ;)
        if (view instanceof EditText) {
            ((EditText) view).setError(message);
        } else {
            Toast.makeText(this, message, Toast.LENGTH_LONG).show();
        }
    }
}

Thank you so much for your quick answer..

@ragunathjawahar
Copy link
Owner

You need to write a QuickRule to validate the fields based on the value selected in your Spinner.

@ronakamlani
Copy link
Author

Do you means my custom rules ?
On Nov 30, 2015 11:30 PM, "Ragunath Jawahar" notifications@github.com
wrote:

You need to write a QuickRule to validate the fields based on the value
selected in your Spinner.


Reply to this email directly or view it on GitHub
#116 (comment)
.

@ragunathjawahar
Copy link
Owner

That's right.

@ronakamlani
Copy link
Author

Please tell me syntax, I can not found QuickRule.

Thank thank you so much for your time.

Regards,
Ronak Amlani.

On Thu, Dec 3, 2015 at 1:48 AM, Ragunath Jawahar notifications@github.com
wrote:

That's right.


Reply to this email directly or view it on GitHub
#116 (comment)
.

@eklam
Copy link

eklam commented Feb 25, 2016

@ronakamlani You can refer to this page

@ragunathjawahar
Copy link
Owner

@eklam Thanks for the wiki. I just built on top of it.

@ronakamlani
Copy link
Author

I see you have created articles for me thank you so much man for that..

Thanks..
:)

On Fri, Feb 26, 2016 at 8:47 AM, Ragunath Jawahar notifications@github.com
wrote:

@eklam https://github.com/eklam Thanks for the wiki. I just built on
top of it.


Reply to this email directly or view it on GitHub
#116 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants