StoreHippo allows you to edit the form field with the widget type. Editing a form field with the widget type involves following steps:
You can add a new widget in design theme section in the StoreHippo Admin Panel. After you have added the widget, you can proceed with the next steps.
To edit the form field widget type, follow the steps given below:
Example 1:
1. After going to the design theme panel, click on add a new widget and add the widget name.
2. Check out an example of the code generating city name with the help of Pincode.
So for that, the template code would be like this as shown,
<label for="{{field.name}}">{{field.label|msTranslate}}</label>
<input type="text" ng-readonly="field.settings.read_only" class="form-control" id="{{field.name}}"
ng-model='fields[field.name]'
placeholder="{{field.settings.placeholder|msTranslate}}">
3. This is the controller code.
function ($scope) {
$scope.$watch('fields.zip', function (newValue, oldValue) {
if ($scope.fields['zip'] == '122001') $scope.fields[$scope.field.name] = 'Gurgaon'
})
}
4. The output will as shown below. By typing Pincode 122001, automatically Gurgaon will come under city-input box.
Example 2:
1. Now if you want by typing City name, Pincode will appear that functionality can be achieved by the below code.
2. Template code will be the same as above, but the controller code would look like this.
function ($scope) {
$scope.$watch('fields.city', function (newValue, oldValue) {
if ($scope.fields['city'] == 'Delhi') $scope.fields[$scope.field.name] = '110001'
})
}
3. Call the widget this time under the Pincode label as shown.
In this way, you can edit the form field with the widget type.