Trying to add dynamic text block on catalog order form

matthew_magee1
Giga Guru

Hello all,

I have a requirement to dynamically show some text based on values from other variables on a catalog order form.

Here is an image that shows the order form... very basic. I ask the user to select a network. The Estimated Delivery Date is the title on a variable set:

find_real_file.png

From here, the user selects a 'Network'. Based on the network, a block appears under the 'Estimated Delivery Date' title (which is a variable set):

find_real_file.png

 

I'm thinking of using a Macro to show the blue box with text. Then I thought of use g_form.showFieldMessage but I need a field to put the message below. In my case, I am thinking I just a Marco variable in my variable set and the macro would display what I need to. The macro would be the only variable in the variable set

 

Any insight/suggestions would be greatly appreciated-

5 REPLIES 5

rahulpandey
Kilo Sage

Hi Matthew, The approach you are considering is the way to go I believe due to the fact, it is just a message. Just a note: Create a widget with same content (since it is just HTML, you can literally copy paste) and, on macro variable, there is a field called widget, just select you widget there. This will make your Catalog service portal compatible. g_form ($scope.page.g_form()) API is available in widget, if it is part of a Catalog item.

Please mark my answer correct if it helped you

Hi Rauhulpandey,

 

I see the field for Widget under the related list Default Value.

I created a simple widget and added it to the widget field of the macro variable.

It now shows up. Wahoo.

 

Now I just need to see if there is a widget is can use as a guide that will get the value from another variable on the form, do some calculation, and then show a 'custom' message 

Hi Matthew,

You can certainly do that via $scope.page.g_form() .

In your widget's client controller, You can get value of another variable like below

var variableValue = $scope.page.g_form.getValue('your variable name');