Forums

Forums / Developing Portals / Boolean Labels

Boolean Labels

4 posts, 1 answered
  1. Eric Mann
    Eric Mann avatar
    59 posts
    Registered:
    16 Oct 2020
    02 Aug 2022
    Link to this post
    We are looking to change the Boolean Labels using the get_model method via JavaScript for instance changing "Yes" to "Allow" in certain situations where changing the label in the Model on the Widget won't fit our Use Case. We do this with some Picklist fields via this method: 
    tpc.forms[0].rfr_primaryca.get_kendoInput().dataSource.data()[1].Label = "Hello"; 
    tpc.forms[0].rfr_primaryca.get_kendoInput().dataSource.data()[2].Label = "Sí"; 
    tpc.forms[0].rfr_primaryca.get_kendoInput().refresh();

    We can get the get_model to return the BooleanLabels but not change the Array / Text. 
  2. Bhargavi Mahal
    Bhargavi Mahal avatar
    14 posts
    Registered:
    16 Dec 2020
    02 Aug 2022
    Link to this post
    Hello Eric,

    Thank you for posting your query.

    Looking at your code, I think you are on a right track. However, after changing the label, the picklist needs a refresh in order to update the value in the front end.

    Please find below code,
    tpc.forms[0].fieldName.get_kendoInput().options.dataSource.data[2].Label = 'Hello';
    tpc.forms[0].fieldName.get_kendoInput().dataSource.read(); 

    Kindly, try this and let me know if it worked.

    Thank you,

    Regards,
    Bhargavi Mahal.
  3. Eric Mann
    Eric Mann avatar
    59 posts
    Registered:
    16 Oct 2020
    03 Aug 2022 in reply to Bhargavi Mahal
    Link to this post
    Bhargavi,
    Yeah we have the picklist feature working and with the .refresh() after the changes. My question is on the Yes/No (Boolean) field type where those text values seems to be in BooleanLabels as an Array. 

    Eric 
  4. Omar S
    Omar S avatar
    51 posts
    Registered:
    04 Jul 2019
    Answered
    12 Oct 2022 in reply to Eric Mann
    Link to this post
    Hi Eric
    If you insist on changing the values via JS, you could do something like this 

    tpc.forms[0].rfr_primaryca.get_kendoInput().setDataSource({
      data: [ { text: "nope", value: "false" }, { text: "yep", value: "true" } ]
    })

    But if you know your values ahead of time, it is best to go into the advanced settings of the Yes/No widget configuration and update the BooleanLabels there.
    Last modified on 12 Oct 2022 15:10 by Omar S
4 posts, 1 answered