@@ -337,29 +337,29 @@ export class WizardPage implements OnInit {
337337 disabilityTouched : boolean = false ;
338338
339339 showRadioDisability ( ) {
340- let alert = this . alertCtrl . create (
340+ let disabilityAlert = this . alertCtrl . create (
341341 {
342342 title :"Dissability" ,
343343 cssClass : "branchRadio" ,
344344 message : "Select One"
345345 } )
346346
347- alert . addInput ( {
347+ disabilityAlert . addInput ( {
348348 type : 'radio' ,
349349 label : 'Yes' ,
350350 value : 'Yes' ,
351351 checked : false
352352 } ) ;
353353
354- alert . addInput ( {
354+ disabilityAlert . addInput ( {
355355 type : 'radio' ,
356356 label : 'No' ,
357357 value : 'No' ,
358358 checked : false
359359 } ) ;
360360
361- alert . addButton ( 'Cancel' ) ;
362- alert . addButton ( {
361+ disabilityAlert . addButton ( 'Cancel' ) ;
362+ disabilityAlert . addButton ( {
363363 text : 'OK' ,
364364 handler : data => {
365365 const percentQuestion = this . firstForm . get ( 'percentQuestionName' )
@@ -376,16 +376,19 @@ export class WizardPage implements OnInit {
376376 }
377377 percentQuestion . updateValueAndValidity ( )
378378 this . disabilityQValue = data ;
379- this . disabilityTouched = true ;
380- }
379+ }
381380 } ) ;
382-
383- alert . present ( ) ;
381+ disabilityAlert . didLeave
382+ . subscribe ( _ => {
383+ this . disabilityTouched = true ;
384+ } )
385+ disabilityAlert . present ( ) ;
384386 }
385387
386388 //questionnaire ######2222222
387389 // show employed question
388- showUnemployed : boolean = false ;
390+ employedInvalid : boolean = true ;
391+ employedTouched : boolean = false ;
389392 employedAnswer : string = "" ;
390393 showEmployedRadio ( ) {
391394 let alert = this . alertCtrl . create ( {
@@ -410,70 +413,72 @@ export class WizardPage implements OnInit {
410413 alert . addButton ( {
411414 text : 'OK' ,
412415 handler : data => {
413- console . log ( "OK" , data ) ;
414- this . employedAnswer = data ;
415- console . log ( this . secondForm . valid , "2ndformValid?" )
416- console . log ( this . secondForm , "2ndform" )
417416 const lastEmployed = this . secondForm . get ( "lastEmployed" )
418417 if ( data == "Unemployed" ) {
419- this . showUnemployed = true ;
418+ this . employedInvalid = false ;
420419 lastEmployed . setValidators ( Validators . required )
421- console . log ( "if -setValidators" )
422420 } else if ( data === "Employed" ) {
423- this . showUnemployed = false ;
421+ this . employedInvalid = false ;
424422 lastEmployed . clearValidators ( )
425- console . log ( "else -clearValidators" , data )
426- } else if ( data === undefined ) {
427- this . showUnemployed = false ;
423+ } else {
424+ this . employedInvalid = true ;
428425 lastEmployed . clearValidators ( )
429- console . log ( "else -clearValidators" , data )
430426 }
427+ this . employedAnswer = data ;
431428 lastEmployed . updateValueAndValidity ( )
432- console . log ( "handler: updateValue" )
433429 }
434430 } ) ;
431+ alert . didLeave
432+ . subscribe ( _ => {
433+ this . employedTouched = true ;
434+ } )
435+
435436 alert . present ( ) ;
436437 }
437438
438439 //question 2) Married
439440 marriedAnswer : string = '' ;
441+ marriedValid : boolean = false ;
442+ marriedTouched : boolean = false ;
440443 showMarriedAlert ( ) {
441- let alert = this . alertCtrl . create (
444+ let marriedAlert = this . alertCtrl . create (
442445 {
443446 title :"Married Status" ,
444447 cssClass : "branchRadio" ,
445448 message : "Select One"
446449 } )
447450
448- alert . addInput ( {
451+ marriedAlert . addInput ( {
449452 type : 'radio' ,
450453 label : 'Yes' ,
451454 value : 'Yes' ,
452455 checked : false
453456 } ) ;
454457
455- alert . addInput ( {
458+ marriedAlert . addInput ( {
456459 type : 'radio' ,
457460 label : 'No' ,
458461 value : 'No' ,
459462 checked : false
460463 } ) ;
461464
462- alert . addButton ( 'Cancel' ) ;
463- alert . addButton ( {
465+ marriedAlert . addButton ( 'Cancel' ) ;
466+ marriedAlert . addButton ( {
464467 text : 'OK' ,
465468 handler : data => {
466- console . log ( "OK" , data ) ;
467469 this . marriedAnswer = data ;
468- if ( data == "Yes" ) {
469-
470- } else if ( data == "No" ) {
471-
470+ if ( data ) {
471+ this . marriedValid = true ;
472+ } else {
473+ this . marriedValid = false ;
472474 }
473475 }
474476 } ) ;
475-
476- alert . present ( ) ;
477+ marriedAlert . didLeave
478+ . subscribe ( _ => {
479+ this . marriedTouched = true ;
480+ } )
481+ marriedAlert . present ( ) ;
477482 }
478483
479484 logFormTwo ( ) {
0 commit comments