Apply Validation for input fields in Property panel on click of button

Hi Team,

Could anybody help me how to apply validation for input fields in Property panel on click of button.Find the piece of code i am using for input field validation.

Validations are applying on load of page itself.My requirement is ,on click of button i need to apply validations for input fields.

   var nodeNameEntry = entryFactory.textField({
    id: 'nodeName',
    description: '',
    label: 'nodeName',
    modelProperty: 'nodeName',
    validate: function(element, values) {
      var nodeNameValue = values.nodeName;
      var validationResult = {};

      var bo = getBusinessObject(element);
      var assigned = bo.$model.ids.assigned(nodeNameValue);
      
      var idError = utils.isIdValid(bo, nodeNameValue);
      return idError ? { nodeName: idError } : {};
    
    }
	
  });
 group.entries.push(nodeNameEntry);

Thanks
-Prameela

Hi Prameela,

the properties panel is build in a way that all changes made in input fields are directly validated and applied without the need of a button. It is a core feature. The validation of input values is hard wired in the code here which makes it difficult to change that behavior in an extension of it, because it is designed to validate instantly (and on load).

May I ask what is your use case of having a button instead of instant validation?

Hi Pedesen,

Thanks for reply.In instant validation,all validations are applying in on load only.I am able to achieve instant validation of input fields in property panel.But in any normal web application user forgot to enter data in any one of the text field and click on save button(for example).In this case we need to intimate the user saying that “Input field should not be empty” like this validation with red mark on click of button.I am working on this requirement only.

I am unable to call “validate” method onclick of button.Please suggest me.If this is not clear,please let me know.

Thanks
-Prameela

Please find the attached piece of code

Input Field:

  var nodeNameEntry = entryFactory.textField({
    id: 'nodeName',
    description: '',
    label: 'nodeName',
    modelProperty: 'nodeName',
   });
 group.entries.push(nodeNameEntry);

Validation:

      $("#js-save-workflow").on('click',function(e){
	
	nodeNameEntry.validate = function(element, values){
		var nodeNameValue = values.nodeName;
		var bo = getBusinessObject(element);
		var validationResult = {};
		var idError = utils.isIdValid(bo, nodeNameValue);
		return idError ? { nodeName: idError } : {};

	};
	
});

In this case when i put alert inside “nodeNameEntry.validate” function,alert value not prompting and navigation is not going inside of a function.Please suggest me how to achieve this

Thanks
-Prameela

Hi Team,

Any update on the above issue?

If the above issue can be resolved please let me the process.

Thanks
-Prameela

Hi Team,

Any update on this issue.Please let me know.

Thanks
-Prameela

What you could do to check for empty input fields is to define a validate method on the entry like that:

var nodeNameEntry = entryFactory.textField({
  [...]
  validate: function(element, values) {
    // check for empty values here
  }
});

The result would be that the input field is always invalid if no input text has been provided. The user can see right away (on load) what input fields have to be filled.

Hi Pedesen,

Thanks for reply.This validation i have done already and working fine in onload but instead of onload how to call “Validate” function on click of button.

Thanks
-Prameela