Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    sonaljatav
    @sonaljatav
    Hey, does anybody has faced the issue where aurelia validation has result.valid= false, although the errors are not shown in UI using validation-error attribute?
    Thanks for the help
    Charles Lindsay
    @VagyokC4
    @sonaljatav If you're using the bootstrap-form-renderer, then your html structure MUST follow the bootstrap form structure..
    agouveiac
    @agouveiac
    Hello there, I am having issues validating an edit form ( populating data via an API call in the activate method). The validation works on the create version of the form. If i remove the code that populated the form the validation works on the edit form, so it is clearly related to it. I am new to Aurelia ans SPA. Any help is welcome, thank you. Here is a link to my question on stack overflow, https://stackoverflow.com/questions/46800306/aurelia-validation-nor-working-when-data-is-pre-populated-in-the-form
    Jason Sobell
    @jsobell
    @agouveiac Sorry, just noticed this. I've posted a response on SO
    Kara
    @rbrlortie

    According to the official docs,

    "The validation controller has a subscribe(callback: (event: ValidateEvent) => void) method you can use to subscribe to validate and reset events. ".

    I try to do this.myValidationController.subscribe() but I get an error saying "this.validationController.subscribe is not a function". Any idea why that is?

    Kara
    @rbrlortie
    Nevermind, I am on a previous version of Aurelia Validate which didn't have that... so I did a good old $('.myComponent input').on("blur",doIt()); which does the job.
    Matthias
    @mredl
    @MaximBalaganskiy aurelia cli
    aurelia-next
    @aurelia-next
    hi guys i am calling this.controller.validate() but this validates all input fields at once. I want to validate one input at a time...
    where this.validator.validateObject(this.todo) is being used... is this the path i need to go down?
    Chris Ragon
    @bdacoderchris
    So I am encountering an issue with changeOrBlur. We have a set of validation rules on our model (Manufacturing Orders). We then have a separate view-model that is used to create new Manufacturing orders. I am running into problems when setting the installation date from an date-picker custom attribute. When the user selects a date it blurs the input box causing the UI to throw an error that Installation Date is Required. The only way to clear this error is to reselect a date or to click in and out of the date input box.
    aurelia-next
    @aurelia-next

    Hi i have set multiple validation controllers using NewInstance
    and i am using addObject to bound the rules to the controller

    everything works great when using ensure etc, but i cant quite get my head around how to add a custom rule

    const controller1Rules = ValidationRules .ensure('addNewRacfId').required().withMessage('User Id is required').minLength(8).withMessage('User Id must at least be 8 characters long.') .rules;
    aurelia-next
    @aurelia-next
    this.controller1ValidationController.addObject(this, controller1Rules);
    aurelia-next
    @aurelia-next
    No worries guys i figured it out :)
    const racfIdValidated = () => { return this.addNewUserRacfFilter(); };
    and called .ensureObject().satisfies(racfIdValidated)
    aurelia-next
    @aurelia-next
    hi all, i have a element on which i am using classList.remove('d-none')
    when validating this element 'd-none' keep reappearing, its as if aurelia doesnt know i removed the class
    aurelia-next
    @aurelia-next

    const racfIdValidated = () => { return false; };

    const racfRules = ValidationRules
      .ensure('addNewRacfId').required()
      .ensureObject().satisfies(racfIdValidated).withMessage('user not found').rules;
    
    this.racfValidationController.addObject(this, racfRules);

    Hi guys, when running this validation i am trying to add a custom rule
    the required is triggering...
    i am tryinng to pass false in racfIdValidated custom rule
    but it is still not showing the custom message of user not found

    const racfIdValidated = () => { console.log('hello world') return false; };
    my console log is showing when running the validation... so it is definitely running the custom validation rule
    aurelia-next
    @aurelia-next
    help please :(
    aurelia-next
    @aurelia-next
    @DevQuestions thanks, found something being applied by you :)
    const racfRules = ValidationRules
          .ensure('addNewRacfId').required()
          .then().satisfies(racfIdValidated).withMessage('user not found').rules;
    i used .then() instead of ensureObject() and done the trick :)
    cheers
    J├╝rgen Wenzel
    @jwx
    Are there any decorators available for validations or is ensure the only way to go?
    Matthias
    @mredl

    hi! i have a question how to make a validation rules with objects which contains nested objects because i always get an error when the rules get parsed:

    export class PartnerItemViewModel  {
       id: number;
       name1: string;
       name2: string;
       address: AddressViewModel;
    }
    
    export class AddressViewModel{
      id: number;
      street: string;
      houseNo: string;
      location: string;
      zipCode: string;
      countryCode: string;
    
    }
    
    ValidationRules
          .ensure((p: PartnerItemViewModel) => p.name1)
            .required().withMessageKey('please_enter')
          .ensure((p: PartnerItemViewModel) => p.name2)
            .required().withMessageKey('please_enter')
          .ensureObject().satisfies(p => p.address).withMessageKey('please_enter')
            .required().withMessageKey('please_enter')
            .then()
              .ensure((p: PartnerItemViewModel) => p.address.street)
              .required().withMessageKey('please_enter')
          .on(this)
          .rules;

    the error is

    Message: Unable to parse accessor function:
    function (p) { return p.address.street; }
    srfabio
    @srfabio
    Hi there, has anyone managed to get aurelia-validation working with the latest webpack skeleton?
    Joel Niklaus
    @JoelNiklaus
    Hi there, I have a big form with cusom form input components each containing its own validation controller. The form does not have any validation controller. When I had one validation controller only in the form it dit not work because of name clashes. How can I check in the form class if the entire form is valid? Any help is greatly appreciated
    Max
    @MaximBalaganskiy
    This is because a validation renderer does not know how to handle your custom controls. For the materialise bridge I wrote a custom renderer which looks for specific methods on custom elements and uses them to render errors. Each control just need to define those couple of methods
    @JoelNiklaus have a look at this price to get an idea aurelia-ui-toolkits/aurelia-materialize-bridge#432
    *PR
    I believe that Aurelia validation should have provided something similar, instead of an ability to register custom renderers
    Eagle94T
    @Eagle94T
    Hi everyone, I have a problem with the validation.
    I have a model with multiple validationRules, which work correctly. This model is used for a view in an array. In the view, I know need to trigger the validation on each of the objects in my array. Is there any way to call the ".required()" on each array-item?
    srfabio
    @srfabio
    @Eagle94T That's a bit confusing to follow, can you share a bit of code?
    Eagle94T
    @Eagle94T
    @srfabio I have a form where multiple persons can be added. The validation of a person, is inside the model of the person. But since the validation is triggered manually in the form-view, I need a require on each person to trigger the validation each time. Something like ensureForEach. But as much as I know, there isn't a method like this.
    Vladimir Georgiev
    @vladimirgeorgiev
    hi guys some help with validation
    i have this code
    constructor(movieData: MovieData, router: Router, validator: Validator, validationRules: ValidationRules) {
    this.data = movieData;
    this.router = router;
    this.validator = validator;
    this.validationRules = validationRules;
        ValidationRules.ensure(this.movie.title).required();
    }
    Tyler J Presley
    @TylerJPresley
    I'm not sure what's going on. Version 1.1.2. I have errors displayed on the page. I can keep clicking the submit button and it keeps adding errors under the fields. It looks like nothing is coming back for instruction.unrender in the render method even if errors already exist.
    meash-nrel
    @meash-nrel
    i'm using Aurelia Validation on change and blur. cursor is on a required text field . user hits a button on the page -- the blur triggers the validation error, however it seems to prevent the button's change event from happening. user has to click the button again to trigger the change event. is there a workaround beyond doing away with blur validation trigger?
    smigielns
    @smigielns

    Hello all. Does anyone know how to use validation on generated inputs inside repeat.for? I would like to validate dynamic form based on Arrays and Maps.
    Examples:

    <div repeat.for="double of doubles"> <!-- doubles is an array -->
        <input placeholder="double ${$index + 1}" value.bind="double & validate">
    </div>
    <div repeat.for="[key,value] of stringDoubleMap"> <!-- stringDoubleMap is a map -->
        <input placeholder="${key}" value.bind="value $ validate">
    </div>

    I need to use similar form to generate XML in output. I would like to validate each generated input separatly.

    Brandon Burciaga
    @bmb0205
    Is there a way to use aurelia validation on regular variables? Use case using redux to manage state of multiple child components. Instead of setting all validation properties in the parent and two way binding into the CEs or something along those lines, can I create local variables of my child component state and validate them without them being class props? As in getState() in the validate() call and check the local vars follow rules? I dont want to make 15+ props on my parent vm and use two way binding everywhere
    lkossis
    @lkossis

    hi! i have a question how to make a validation rules with objects which contains nested objects because i always get an error when the rules get parsed:

    export class PartnerItemViewModel  {
       id: number;
       name1: string;
       name2: string;
       address: AddressViewModel;
    }
    
    export class AddressViewModel{
      id: number;
      street: string;
      houseNo: string;
      location: string;
      zipCode: string;
      countryCode: string;
    
    }
    
    ValidationRules
          .ensure((p: PartnerItemViewModel) => p.name1)
            .required().withMessageKey('please_enter')
          .ensure((p: PartnerItemViewModel) => p.name2)
            .required().withMessageKey('please_enter')
          .ensureObject().satisfies(p => p.address).withMessageKey('please_enter')
            .required().withMessageKey('please_enter')
            .then()
              .ensure((p: PartnerItemViewModel) => p.address.street)
              .required().withMessageKey('please_enter')
          .on(this)
          .rules;

    the error is

    Message: Unable to parse accessor function:
    function (p) { return p.address.street; }

    I'm having exactly the same issue. I prefer to keep my form bindings in a model as well, but the accessor function fails every time, forcing me to move the properties outside of a model. That is a solution, I guess, but shouldn't there be a simple way of doing this?

    Sajeetharan
    @sajeetharan
    hi guys
    Jason
    @jasonhjohnson
    Anyone know how I can use validation to validate that a radio button group selection is made for each of my dynamic Questions?
    elitemike
    @elitemike
    I need to load the validation plugin in karma, but I'm not testing a ui component. How do i properly load the plugin for a model validation test
    Tiago Mendes
    @tgmendes
    Hey everyone
    Don't know if this has been answered, but is there a way in the View to know if a given input field is required (i.e., defined as required when defining the field's validation rules?)