validator is capturing error- how can I disable a button based off of this error? The Next CEO of Stack OverflowAngular 2 Reactive Forms custom validator not setting error typemodel driven form: validation not working as expected in Angular 2Using ngModel with Reactive formsHow to validate multiple forms in a html page?Angular material 2 datepicker with [ngmodel]Ionic 3 FormBuilder, How to validate ion-select ion-option?errors.js:55 ERROR TypeError: Cannot set property '0' of undefinedBootstrap-datepicker (daterange) - how to refresh dates on calendar when data is reloadedsetting validator on formgroupAngular 7 and Form Arrays disable a button of a form group if the related form group is not valid is giving an error of undefined

Different harmonic changes implied by a simple descending scale

What can we do to stop prior company from asking us questions?

Skipping indices in a product

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

How do we know the LHC results are robust?

How to transpose the 1st and -1th levels of arbitrarily nested array?

MessageLevel in QGIS3

Are there any unintended negative consequences to allowing PCs to gain multiple levels at once in a short milestone-XP game?

Extending anchors in TikZ

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

How to avoid supervisors with prejudiced views?

How to add tiny 0.5A 120V load to very remote split phase 240v 3 wire well house

What is the result of assigning to std::vector<T>::begin()?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

How does the mv command work with external drives?

Non-deterministic sum of floats

Is there a way to save my career from absolute disaster?

What do "high sea" and "carry" mean in this sentence?

Received an invoice from my ex-employer billing me for training; how to handle?

Why do we use the plural of movies in this phrase "We went to the movies last night."?

How to make a variable always equal to the result of some calculations?

How do scammers retract money, while you can’t?

What does "Its cash flow is deeply negative" mean?



validator is capturing error- how can I disable a button based off of this error?



The Next CEO of Stack OverflowAngular 2 Reactive Forms custom validator not setting error typemodel driven form: validation not working as expected in Angular 2Using ngModel with Reactive formsHow to validate multiple forms in a html page?Angular material 2 datepicker with [ngmodel]Ionic 3 FormBuilder, How to validate ion-select ion-option?errors.js:55 ERROR TypeError: Cannot set property '0' of undefinedBootstrap-datepicker (daterange) - how to refresh dates on calendar when data is reloadedsetting validator on formgroupAngular 7 and Form Arrays disable a button of a form group if the related form group is not valid is giving an error of undefined










0















I'm pretty new to this code base, but it appears that these date controls have a validator dateRange that checks if the startDate is greater than the endDate:



static dateRangeV2(startControlName: string, endControlName: string) 
return (group: FormGroup) => ;



In the Angular code, the date controls are setup like so. When the dateRange fails, the controls highlight in error (red). There is a button that is defined in the HTML section that I would like to disable if this validator fails.



private initForm(model?: Lookup) 
const fileTypes: number[] = [];
if (model)
this.lookupName = model.lookupName;
model.lookupClientFileTypeLink.forEach(x =>
fileTypes.push(x.clientFileTypeId)
);

this.form = this._fb.group(

startEffectiveDate: [
model ? Shared.toPlainDate(model.startEffectiveDate) : "",
Validators.compose([
Validators.required,
HlrValidators.plainDate
])
],
endEffectiveDate: [
model
? Shared.toPlainDate(model.endEffectiveDate)
: Shared.toPlainDate(Shared.maxDate),
Validators.compose([
Validators.required,
HlrValidators.plainDate
])
],
query: [model ? model.query : "", Validators.required]
,

validator: HlrValidators.dateRange(
"startEffectiveDate",
"endEffectiveDate"
)




I have a property that I would like to set when the validator returns an error:



dateErrorDisabled: boolean;


I just don't know how to set it when the validator returns an error. I see that the validator sets a property on the control(dateRange: true).



What is the proper way to capture this information so I can set the property and the button can use the property to determine if the button is disabled?










share|improve this question




























    0















    I'm pretty new to this code base, but it appears that these date controls have a validator dateRange that checks if the startDate is greater than the endDate:



    static dateRangeV2(startControlName: string, endControlName: string) 
    return (group: FormGroup) => ;



    In the Angular code, the date controls are setup like so. When the dateRange fails, the controls highlight in error (red). There is a button that is defined in the HTML section that I would like to disable if this validator fails.



    private initForm(model?: Lookup) 
    const fileTypes: number[] = [];
    if (model)
    this.lookupName = model.lookupName;
    model.lookupClientFileTypeLink.forEach(x =>
    fileTypes.push(x.clientFileTypeId)
    );

    this.form = this._fb.group(

    startEffectiveDate: [
    model ? Shared.toPlainDate(model.startEffectiveDate) : "",
    Validators.compose([
    Validators.required,
    HlrValidators.plainDate
    ])
    ],
    endEffectiveDate: [
    model
    ? Shared.toPlainDate(model.endEffectiveDate)
    : Shared.toPlainDate(Shared.maxDate),
    Validators.compose([
    Validators.required,
    HlrValidators.plainDate
    ])
    ],
    query: [model ? model.query : "", Validators.required]
    ,

    validator: HlrValidators.dateRange(
    "startEffectiveDate",
    "endEffectiveDate"
    )




    I have a property that I would like to set when the validator returns an error:



    dateErrorDisabled: boolean;


    I just don't know how to set it when the validator returns an error. I see that the validator sets a property on the control(dateRange: true).



    What is the proper way to capture this information so I can set the property and the button can use the property to determine if the button is disabled?










    share|improve this question


























      0












      0








      0








      I'm pretty new to this code base, but it appears that these date controls have a validator dateRange that checks if the startDate is greater than the endDate:



      static dateRangeV2(startControlName: string, endControlName: string) 
      return (group: FormGroup) => ;



      In the Angular code, the date controls are setup like so. When the dateRange fails, the controls highlight in error (red). There is a button that is defined in the HTML section that I would like to disable if this validator fails.



      private initForm(model?: Lookup) 
      const fileTypes: number[] = [];
      if (model)
      this.lookupName = model.lookupName;
      model.lookupClientFileTypeLink.forEach(x =>
      fileTypes.push(x.clientFileTypeId)
      );

      this.form = this._fb.group(

      startEffectiveDate: [
      model ? Shared.toPlainDate(model.startEffectiveDate) : "",
      Validators.compose([
      Validators.required,
      HlrValidators.plainDate
      ])
      ],
      endEffectiveDate: [
      model
      ? Shared.toPlainDate(model.endEffectiveDate)
      : Shared.toPlainDate(Shared.maxDate),
      Validators.compose([
      Validators.required,
      HlrValidators.plainDate
      ])
      ],
      query: [model ? model.query : "", Validators.required]
      ,

      validator: HlrValidators.dateRange(
      "startEffectiveDate",
      "endEffectiveDate"
      )




      I have a property that I would like to set when the validator returns an error:



      dateErrorDisabled: boolean;


      I just don't know how to set it when the validator returns an error. I see that the validator sets a property on the control(dateRange: true).



      What is the proper way to capture this information so I can set the property and the button can use the property to determine if the button is disabled?










      share|improve this question
















      I'm pretty new to this code base, but it appears that these date controls have a validator dateRange that checks if the startDate is greater than the endDate:



      static dateRangeV2(startControlName: string, endControlName: string) 
      return (group: FormGroup) => ;



      In the Angular code, the date controls are setup like so. When the dateRange fails, the controls highlight in error (red). There is a button that is defined in the HTML section that I would like to disable if this validator fails.



      private initForm(model?: Lookup) 
      const fileTypes: number[] = [];
      if (model)
      this.lookupName = model.lookupName;
      model.lookupClientFileTypeLink.forEach(x =>
      fileTypes.push(x.clientFileTypeId)
      );

      this.form = this._fb.group(

      startEffectiveDate: [
      model ? Shared.toPlainDate(model.startEffectiveDate) : "",
      Validators.compose([
      Validators.required,
      HlrValidators.plainDate
      ])
      ],
      endEffectiveDate: [
      model
      ? Shared.toPlainDate(model.endEffectiveDate)
      : Shared.toPlainDate(Shared.maxDate),
      Validators.compose([
      Validators.required,
      HlrValidators.plainDate
      ])
      ],
      query: [model ? model.query : "", Validators.required]
      ,

      validator: HlrValidators.dateRange(
      "startEffectiveDate",
      "endEffectiveDate"
      )




      I have a property that I would like to set when the validator returns an error:



      dateErrorDisabled: boolean;


      I just don't know how to set it when the validator returns an error. I see that the validator sets a property on the control(dateRange: true).



      What is the proper way to capture this information so I can set the property and the button can use the property to determine if the button is disabled?







      angular






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 21 at 18:42







      webdad3

















      asked Mar 21 at 16:59









      webdad3webdad3

      4,2102399192




      4,2102399192






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285609%2fvalidator-is-capturing-error-how-can-i-disable-a-button-based-off-of-this-error%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285609%2fvalidator-is-capturing-error-how-can-i-disable-a-button-based-off-of-this-error%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript