Skip to content

Commit

Permalink
Fixed clear response issue and Modification made by Shreel in resgist…
Browse files Browse the repository at this point in the history
…er.html
  • Loading branch information
DeepankarSinha authored and rushi216 committed Aug 28, 2017
1 parent aeafaeb commit 32c1997
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,42 @@ <h2>Registration Form</h2>
<label>First Name</label>
<input required pattern="^[a-zA-Z_ ]*$" type="text" class="form-control" [(ngModel)]="testAttendees.firstName" name="firstName" #firstName="ngModel" maxlength="255" />
<div class="errors-container">
<span *ngIf="firstName.touched && !firstName.valid && firstName.errors.pattern" class="error-msg">First name must be in alphabets</span>
<span *ngIf="firstName.touched && !firstName.valid && firstName.errors.required" class="error-msg">Required</span>
<span *ngIf="firstName.touched && !firstName.valid && firstName.errors.pattern" class="error-msg">First Name can only contain letters, underscores or spaces.</span>
<span *ngIf="firstName.touched && !firstName.valid && firstName.errors.required" class="error-msg">This field is required.</span>
</div>
</div>
<div class="form-group">
<label>Last Name</label>
<input required pattern="^[a-zA-Z_ ]*$" type="text" class="form-control" [(ngModel)]="testAttendees.lastName" name="lastName" #lastName="ngModel" maxlength="255" />
<div class="errors-container">
<span *ngIf="lastName.touched && !lastName.valid && lastName.errors.pattern" class="error-msg">Last name must be in alphabets</span>
<span *ngIf="lastName.touched && !lastName.valid && lastName.errors.required" class="error-msg">Required</span>
<span *ngIf="lastName.touched && !lastName.valid && lastName.errors.pattern" class="error-msg">Last Name can only contain letters, underscores or spaces.</span>
<span *ngIf="lastName.touched && !lastName.valid && lastName.errors.required" class="error-msg">This field is required.</span>
</div>
</div>
<div class="form-group">
<label>Email</label>
<input required pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{3}" type="email" class="form-control" [(ngModel)]="testAttendees.email" name="email" #email="ngModel" maxlength="255" />
<div class="errors-container">
<span *ngIf="email.touched && !email.valid && email.errors.pattern" class="error-msg">Invalid email address</span>
<span *ngIf="email.touched && !email.valid && email.errors.required" class="error-msg">Required</span>
<span class="error-msg" *ngIf="isErrorMessage">This email id already exists.</span>
<span *ngIf="email.touched && !email.valid && email.errors.pattern" class="error-msg">This Email is invalid.</span>
<span *ngIf="email.touched && !email.valid && email.errors.required" class="error-msg">This field is required.</span>
<span class="error-msg" *ngIf="isErrorMessage">This Email already exists.</span>
</div>
</div>
<div class="form-group">
<label>Roll Number</label>
<input required pattern="^[a-zA-Z0-9]*$" type="text" class="form-control" [(ngModel)]="testAttendees.rollNumber" name="rollNumber" #rollNumber="ngModel" />
<div class="errors-container">
<span *ngIf="rollNumber.touched && !rollNumber.valid && rollNumber.errors.pattern" class="error-msg">Invalid roll number</span>
<span *ngIf="rollNumber.touched && !rollNumber.valid && rollNumber.errors.required" class="error-msg">Required</span>
<span class="error-msg" *ngIf="isErrorMessage">This roll number already exists.</span>
<span *ngIf="rollNumber.touched && !rollNumber.valid && rollNumber.errors.pattern" class="error-msg">This Roll Number is invalid.</span>
<span *ngIf="rollNumber.touched && !rollNumber.valid && rollNumber.errors.required" class="error-msg">This field is required.</span>
<span class="error-msg" *ngIf="isErrorMessage">This Roll Number already exists.</span>
</div>
</div>
<div class="form-group">
<label>Contact Number</label>
<input required pattern="^[+]?([0-9]{0,15})$" type="text" class="form-control" [(ngModel)]="testAttendees.contactNumber" name="contactNumber" #contactNumber="ngModel" maxlength="15" />
<div class="errors-container">
<span *ngIf="contactNumber.dirty && !contactNumber.valid && contactNumber.errors.pattern" class="error-msg">This field should contain numeric values only.</span>
<span *ngIf="contactNumber.touched && !contactNumber.valid && contactNumber.errors.required" class="error-msg">Required</span>
<span *ngIf="contactNumber.dirty && !contactNumber.valid && contactNumber.errors.pattern" class="error-msg">Contact Number can only contain numbers.</span>
<span *ngIf="contactNumber.touched && !contactNumber.valid && contactNumber.errors.required" class="error-msg">This field is required.</span>
</div>
</div>
<div class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ export class TestComponent implements OnInit {
let testStatus = response;
if (testStatus !== TestStatus.allCandidates) {
//Close the window if Test is already completed
window.close();
this.routeForTestEnd = 'conduct/' + this.testLink;
this.router.navigate(['/test-end'], { relativeTo: this.routeForTestEnd, replaceUrl: true });
}
window.addEventListener('blur', (event) => { if (this.test.browserTolerance !== 0 && !this.istestEnd) this.windowFocusLost(event); });
window.addEventListener('offline', () => { this.isCloseWindow = false; this.isConnectionLoss = true; this.saveTestLogs(); this.endTest(TestStatus.completedTest); });
Expand Down Expand Up @@ -444,8 +445,6 @@ export class TestComponent implements OnInit {
this.questionIndex = index;
//Reset time counter for question
this.timeOutCounter = 0;

this.isTestReady = true;
}

runCode() {
Expand Down Expand Up @@ -510,7 +509,7 @@ export class TestComponent implements OnInit {
testAnswer.questionStatus = QuestionStatus.answered;

this.questionStatus = QuestionStatus.answered;
} else if (testQuestion.questionStatus === QuestionStatus.selected) {
} else if (testQuestion.questionStatus === QuestionStatus.selected || testQuestion.questionStatus === QuestionStatus.answered) {
testAnswer.questionStatus = QuestionStatus.unanswered;
} else {
testAnswer.questionStatus = testQuestion.questionStatus;
Expand Down

0 comments on commit 32c1997

Please sign in to comment.