Set default value for text field in iparams

The following post suggests a default value can be set for text field iparams but I am finding this does not work - the text field does not have the desired pre-populated default text.

I have this iparam:

  "SAFR_Reseller_Technical_Training": {
    "display_name": "SAFR Reseller Technical Track Courses",
    "description": "Courses that make up the technical track (include starting course).",
    "default_value": "TT101, TT102, TT103, TT150, TT151, TT152, TT153, TT154, TT201, TT250, TT260, TT301, TT401, TT402, TT405, TT406",
    "type": "text",
    "required": true
  },

When I install the app, the default iparam is not loaded:

User documentation suggests the accepted answer in the post is incorrect:

Is it possible to have text field contain pre-populated value?

I went ahead a built a sample and tested this locally. I was able to get these values filled in.

Here is the zip file for your reference:

fsales.zip (4.5 KB)

Another option is for you to make your installation page dynamic and set the default value onFormLoad

2 Likes

It appears that on 1st run, the defaults do get populated but if you update iparams.json after the first run, defaults are not populated.

I’ll just work around this thru documentation but I feel like if you add a new property it should populate with default.

1 Like

Thanks for adding this piece of information, Steve.

By above, did you mean, if user updates the iparams.json and publishes a new version of the app… The existing installation parameter with default_value no longer renders the sets defalut value in v2 of the app?

Yes, or more correctly "if the developer updates the iparams.json and publishes, a new version of the app, then the default value does not get populated into the new field - the new property is blank in the config page.

Here is screenshot of config page with 2 fields added to your example. “*Course 2” was added before 1st run. “*Course 3” was added after first run. JSON for both are below.

JSON for above config page:

{
    "SAFR_Reseller_Technical_Training": {
    "display_name": "SAFR Reseller Technical Track Courses",
    "description": "Courses that make up the technical track (include starting course).",
    "default_value": "TT101, TT102, TT103, TT150, TT151, TT152, TT153, TT154, TT201, TT250, TT260, TT301, TT401, TT402, TT405, TT406",
    "type": "text",
    "required": true
  },
    "SAFR_Reseller_Technical_Training2": {
    "display_name": "SAFR Reseller Technical Track Courses 2",
    "description": "Courses that make up the technical track (include starting course).",
    "default_value": "TT101, TT102, TT103, TT150, TT151, TT152, TT153, TT154, TT201, TT250, TT260, TT301, TT401, TT402, TT405, TT406",
    "type": "text",
    "required": true
  },
    "SAFR_Reseller_Technical_Training3": {
    "display_name": "SAFR Reseller Technical Track Courses 3",
    "description": "Courses that make up the technical track (include starting course).",
    "default_value": "TT101, TT102, TT103, TT150, TT151, TT152, TT153, TT154, TT201, TT250, TT260, TT301, TT401, TT402, TT405, TT406",
    "type": "text",
    "required": true
  }
}
1 Like