Priti_P 0 Junior Poster

Hello There,

I have used below code for input field and error span

<form name='SubmitGuest' class='simple-form'>
    <div>
        <span class="lable"> Guest Name</span>
        <input type="text" style="margin-left:0.5px;" name="guest_name" ng-pattern="/^([a-zA-Z]+\s*)*[a-zA-Z]+$/" ng-model="guestData.guestName" required  placeholder="Guest Name"/>
            <span ng-show="SubmitGuest.guest_name.$error.pattern">
                Please enter valid Name
            </span>
    </div>
    <!--
        such multiple div for fields.
    -->
</form>

It is working correct.
I have used same form for both edit and add Guest.
On click of Add I have used one function reset() which clears data of form.

$scope.resetForm = function(){
    $scope.guestData = {};
  }

If the input field is withour any error message then this function is working correctly.
On Add click input field will be cleared.

But if field is with error (for example: in above input If i entered 213123 then it will show me error span and) on click of Add this will remain there.

What should I do for removing/clearing error too?
Same is ahapping for Textareas too.