1
0
-1

Hello,

Is it possible to update/set label on field via javascritpt in Maestro?

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hi Kamil, 

      You can apply dynamic content in your field labels using the Insert Field Value button in the label editor:

      You can insert values from fields that the user has entered or values from hidden Data Fields that you update via script:

      1. Mark Murray

        Hi,

        is it possible to make this behavior conditional?

        I would like to achieve the following:

        if isBlank(data.name) return "Applicant 1"

        else return "data.name"

        I tried entering some JavaScript in the box, but it came out as text.

         

        Thanks

        Mark

      2. Ben Warner

        Yes it is. You can do this by adding a data field that has your conditional logic in the calculation rule. Then include the data field in the label instead of the actual name field.

      3. Mark Murray

        Thanks Ben, I was being a bit ambitious and trying to put all of that behavior in the one field. Breaking it in to the two pieces as you suggest makes it a bit more manageable. I'll give that a try. Thanks

      4. Mark Murray

        Hi Ben, I've set this up, but the label is blank. Am I missing a trigger? I used the conditional script as shown above, but it does not seem to return anything? Just wondering how to debug this? Thanks

      5. Ben Warner

        Hey Mark, can you confirm that your data field is visible? It may seem like a strange question because data fields don't take up any space on the page. The issue is that calculation rules do not run if the field is not visible by rule, so if the data field is contained in a block that has a visibility rule on it and the block is not visible for example, then the calculation rule will not run.

      6. Mark Murray

        Hi Ben, I assume it's visible as I can't find anything that suggest it's not. On the Properties tab there is no option to add any more rules; only Calculation is present. The data field is within a Section > Block that are all visible. There is nothing displayed on the Styles tab, and the Data tab has the Hidden data panel. I tried to set the Clear hidden data to Never, but that didn't have any impact. So, I'm running out of ideas. Thanks

      7. Ben Warner

        Works fine for me, can you change your javascript calculation rule on the data field to the following: if(Util.isBlank(data.name)){ return "Applicant 1"; } return data.name;

      8. Mark Murray

        Hi Ben,

        I have this working for a TextDispaly, but can't seem to get it working for a PageGroup, as part of the navigation.

        I'm trying to get the following to display in the navigation chevron:

        if isBlank(name) display "Your Details"

        else display (name)' s Details, e.g. Mark's Details

        is that possible?

         

        I have a data field with a calculation rule to manipulate the name; that is working correctly because I can observe the behaviour in the textDisplay, but in the NavigationChevron I only get 'blank'.

        Thanks

      9. Ben Warner

        I'll take a look and get back to you.

      10. Ben Warner

        Looks like you've discovered a bug Mark - I've raised this with the Maestro team (internal ref TPD-4691).

        In the meantime you can add a page group with 1 page in it and give the page group a dynamic label to match the page title.

      11. Mark Murray

        OK, I'll experiment a bit and see what I can achieve. I'll keep an eye out for the bug fix.

        Thanks

      CommentAdd your comment...