Giter Site home page Giter Site logo

ng-remote-validate's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ng-remote-validate's Issues

Validate initial value

I'm working on a sign-up flow where ng-model for the validating input field is populated on a previous screen before the is added to DOM.

When the input field is shown, the current pre-populated value is not sent to the server, onload, can this be done?

We don't need to check initial value!

If we come to edit mode. Have there for example 'abcd' and enter some 'abcde' and then remove e -> we get error validation because this value already exists. It's wrong as for me. How to prevent this?

Invalid inputs stay invalid when emptied (even if they are $pristine)

Setup: AngularJS v1.2.27

In my application I have a couple of fields using the remote validation directive. If I enter some invalid text and then empty the input box, the ng-invalid-ng-remote-validate class is not removed (even if the ng-dirty class is removed and ng-pristine is added).

Should these lines be expanded and return with a setValidation() call?

Dependency on Angular

bower.json should specify a dependency on Angular so that utilities like main-bower-files can ensure that Angular is loaded before ng-remote-validate.

(Until then, a manual override of the dependencies key is necessary in the bower.json of any project using this package.)

Question

Is it possible to fire the validation manualy if an other element (e.g. a radio group button) has changed? How can I do that?

Thank you

Previous requests are not canceled, if the data is taken from the cache

Hello. When first time enter "test" in my input, validation work fine, but when I again enter "test" in input, i get validation for word "tes", because validation for word "test" is taken from the cache but after this request for "tes" ends and replace validation for "test".

I think you need to add a check in function "handeChange" in this section of code.

if (cache[value]) {
       return setValidation( cache[ value ], true );
}                      

Something like this:

 if (cache[value]) {
       if (request) {
            $timeout.cancel(request);
       }
       return setValidation( cache[ value ], true );
}               

Use constant for ng-remote-validate attribute?

Hi there,

this does not seem to work:
<input type="email" class="form-control" required ng-model="order.account.email" ng-remote-validate="[AFTERCARE + '/misc/email']" ng-remote-method="POST">

My project has AFTERCARE assigned to the $rootScope and print this out works, but inside the attribute it throws an error (ReferenceError: AFTERCARE is not defined).

Any idea?

Include additional data in validation request

We can use the custom validation callback to inject extra information into the validation callback, but it would be good if the current controller/route and input name could be included by default

Custom Callback not working

Hi,

I tried using your directive, but can't seem to get the Custom call back working:

HTML:

<input type="email" name="email" ng-model="user.email" ng-remote-validate="{ '/user/checkEmailValid' : 'uniqueEmail'}" />

Controller:

var registrationApp = angular.module('registrationApp',['ui.utils','remoteValidation']);
registrationApp.controller('RegistrationCtrl', function ($scope, $http, $window) {
    $scope.emailSetArgs = function( val, el, attrs, ngModel ) {
        return { test: val };
    };
});

It is always sent as { value: val } instead of { test: val }. I was thinking of sending the string straightaway without any JSON array.

Am I doing anything wrong in my code?

formName.fieldName.$error.ngRemoteValidate doesn't work

I'm using this to validate an email field remotely.

Looking at the console, the HTTP.GET works exactly as it should and returns {"isValid":bool,"value":"[email protected]"} but my message doesn't show up if isValid is false.

 <span ng-show="userRegistrationForm.email_addr.$error.ngRemoteValidate">
     This email address already exists.
 </span>

And basically, this is what the email field looks like:

<div class="item item-input">

      <span class="input-div">Email</span>
      <input type="email"
             name="email_addr"
             ng-model="userAccountData.email"
             ng-pattern="/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/"
             ng-remote-validate="http://somewhere.com/api/check_email_existence"
             ng-remote-throttle="400"
             ng-remote-method="GET"
             required>
      <span ng-show="userRegistrationForm.email_addr.$error.ngRemoteValidate">
        This email address already exists.
      </span>
    </div>

Maybe I don't know how to use formName.fieldName.$error.ngRemoteValidate so maybe someone can tell me?

Also, I'm not sure about this but I decided to try and output value of formName.fieldName.$error.ngRemoteValidate doesn't work like this:

<span ng-show="userRegistrationForm.email_addr.$error.ngRemoteValidate">
       {{userRegistrationForm.email_addr.$error.ngRemoteValidate}}
        This email address already exists.
 </span>

...and using FireBug (in Firefox), it doesn't show any value.

Invalid fields stay invalid when emptied

I have form with two remotely validated input. They both have an ng-required condotion:

<form name="myName">
    <input type="text" name="firstInput" ng-required="true"/>
    <input type="text" name="secondInput" ng-required="false"/>
</form>

Now, if I add a remote validation to both the inputs, I observe a strange behaviour. If I get to a state where both the inputs are invalid (according to the remote validation), and I empty both of them, firtInput gets the ng-remote-valid class, while secondInput keeps the ng-remote-invalid class.

Now, even if I insert a value in the first input, my form stays invalid.

Custom Data Sent Documantation not clear

Hi there! Loving your plugin so far, but... do you think you could elaborate a bit more about the inputNameSetArgs callback?

E.g. What are the parameters? How do you name the callback? (Most of my form inputs have names like "licenseForm[name]". Symfony2 convention)

Additional Parameters

Thanks for the useful plugin.

I would like to send through additional parameters (like an action) to the server. Is this supported?

Validation conflict

First, thanks for the awesome module, it's a great help!

One problem I have though is the following:

  • I enter an invalid value 'abc', which correctly displays as invalid,
  • I add a letter 'd', i.e. 'abcd', which makes the value valid,
  • Before the server answers I remove the 'd' again,
  • When the server finally responds, there's 'abc' in the input and it displays wrongly as valid

It's easiest to check the issue with a long throttle, but it seems to happen without a throttle as well.

PS: There's a typo in the wiki at the very beginning "ngRemoveValidate".

Minor naming issue

Hi man! Thank a lot for this directive.
I have seen in code that var had called "dirictiveId"
But angular spelling is "directive"
It's confusing a little.

Block submission until validation is processed

Hi,
I have a form with an email field that is added to a form with a ngIf condition and which is validated by my backend.
I have noticed that if I press enter (o submit with a button) before the validation has been processed, my form is submitted even if the email field has not yet been validated.
Is there any way to prevent the submission until all the remote validation are complete?

Multiple remote validations

There should be a way to apply multiple remote validations to the same input field. As far as I can tell, you can only apply one.

Minor issue with example

An issue with this HTML: 'for' requires an ID to be set on the input field, e.g. <input id="currentPassword" ... >

Really nit-picky, just thought you might want to improve the HTML a bit.

<label for="currentPassword">Current</label> <input type="password" name="currentPassword" placeholder="Current password" ng-model="password.current" ng-remote-validate="/customer/validpassword" required>

publish to npm

The module is not currently being published to npm, could this be added?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.