
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:16 PM
I want to add button on service catalog form ---> "Reset", which will clear all variables values.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:56 PM
Hello
you can create a custom type variable and tag your widget in that variable which will render the button on the catalog form
please try below code in the widget
Html:
<button type="button" class="btn btn-danger btn-block" ng-click="c.clearValue()">Reset Values</button>
Client controller:
api.controller=function($scope) {
/* widget controller */
var c = this;
c.clearValue = function() {
alert('test');
var g_form = $scope.page.g_form;
var allFields = g_form.getFieldNames();
alert(allFields);
for(var fieldName in allFields){
g_form.setValue(allFields[fieldName],'');
}
};
};
Please try this and if it works please mark my answer as correct

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 03:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 03:50 PM
hello
please pass $Scope in your function in the first line
api.controller =function($scope){
And also use this to clear value it clears all the values
var allFields = g_form.getFieldNames();
alert(allFields);
for(var fieldName in allFields){
g_form.setValue(allFields[fieldName],'');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 03:55 PM
if yes please mark my answer correct

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 04:02 PM
Heyy Mohit..
Thank You very very much brother...
code working as expected
--
Thank You
Your Friend - Ganesh Palve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 04:06 PM
Any time
mark my answer correct and close the thread so that it will be helpful for others with same query