Validation issue in custom installation page

Hello all,

I am building a custom installation page and experiencing issue with the validate() method in iparams.html.

validate() method is always reporting validation error in the form irrespective of returning true/false. Below is my code snippet:

validate() method in iparams.html

function validate () {
  validateHpApiKey($('#hpApiKey').val()).then(data => {
    return data

validateHpApiKey() method in iparams.js

function validateHpApiKey (hpApiKey) {
  return new Promise(resolve => {
    hpApiKey = hpApiKey.trim()
    if (!hpApiKey) {
      showValidationMessage('hpApiKey', 'This field is required!')
    } else {
      const options = {
        body: JSON.stringify({
          param: hpApiKey,
      }`${API_DOMAIN}/api_key/true`, options).then(
        function (data) {
          // Upon success, just resolve
        function (error) {
          // Upon failure - send an appropriate validation error message
          showValidationMessage('hpApiKey', 'This API Key does not exist. Please enter the right one')

Hi @Vvikas
you need to return the value in validate method, otherwise, it throws an error,


function validate () {
  return validateHpApiKey($('#hpApiKey').val()) // this should either return true/false or promise to return true/false

hope it helps :slight_smile:


Ahh, thank you it worked! I was under impression that I could return only boolean from validate() method.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.