Input validation on Portal -: sp-editable-fileds

sonalishind
Tera Contributor

 

Hi Team,
I have below HTML code and the profile page(First name, last name, email,phone render using Inline sp-editable-fileds(fieldModel) , not using HTML input) So How we can add validation (invalid input)on that profile page.
Note: Cancel and save button are field specific its not global)

 
 

<div class="panel panel-default b" ng-if="getSysUserModelFields().length > 0">
<div class="panel-heading">
<h2 class="panel-title">
<i class="fa fa-info-circle m-r-sm"></i>${About}
</h2>
</div>
<div class="body padder-xs">
<div class="list-group">
<div ng-repeat="fieldModel in sysUserModelFields">
<div class="list-group-item">
<div>
<sp-editable-field block="true" table="{{data.table}}" editable-by-user="data.isLoggedInUsersProfile" table-id="data.sysUserID" field-model="fieldModel"></sp-editable-field>
</div>
</div>
</div>
</div>
</div>

1 REPLY 1

Huynh Loc
Mega Sage

Hi @sonalishind , 

You can add the on-change attribute to the sp-editable-field element to handle value changes.


Example:

Client Controller:

$scope.onChangeCompany = function (gform, shadowModel, oldValue, newValue) {
	if (oldValue !== newValue) {
		$scope.data.sysUserModel.department = "";
		$scope.data.sysUserModel.location = "";
	}
};

 

HTML:

<sp-editable-field ng-if="::displayField('sys_user', 'company', true)"
                   editable-by-user="data.isLoggedInUsersProfile"
                   table="sys_user"
                   table-id="data.sysUserID"
                   field-model="data.sysUserModel.company"
                   on-change="onChangeCompany"></sp-editable-field>

 

If you found this response helpful, please consider marking it as Correct and Helpful. You may mark more than one reply as an accepted solution.