On change input Forms | Community
Skip to main content
Level 2
June 19, 2023
Solved

On change input Forms

  • June 19, 2023
  • 1 reply
  • 2929 views

Greetings ,
What I'm trying to do is to make my input change according to my enumeration. I want the value of my enumeration to be added to my input which will be displayed

Here is my data Schema :

 

<enumeration basetype="string" name="AEnum"> <value label="first Value" name="firstValue" value="firstValue"/> <value label="second Value" name="secondValue" value="secondValue"/> </enumeration> <element desc="Test" img="fts:test.png" label="Test" name="test" template="xtk:workflow:activity"> <attribute enum="AEnum" label="A" name="AEnumeration" type="string"/> <element label="Content" name="content" type="memo" xml="true"/> </element>

 

And here is my input forms :

 

<input xpath="@AEnumeration"/> <input xpath="content"/>

 

What I'd like is for the value of my input, which is string, to be added each time I click on an element in my enumeration,
thanks in advance for your help!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AnasSpir05

@anasspir05 , 

In 1st case, when you select 'first value' in dropdown and content as "hello this is my " and click on Save, final content will become as "hello this is my first value" (you can refresh the console, so that this final value will get reflected in input form as well.)

And next time, when you select 'second value' in dropdown and with the same content for the same record and click on save, it will update as "hello this is my Second value" in schema (you can refresh the console, so that this new updated value will get reflected in input form as well.)

 

But if you want "hello this is my First Value Second value" after the above mentioned 2nd scenario, only way from input form is, you need to copy the final content and paste it in content, and then select the dropdown value.

 


Hi ,

THANK U @parthasarathy  And @aggabhi for Your Help ,
I found the solution in fact it is the SOAP call, I have two input attributes and one output then what I do is that I create a function that processes all that and each time I click on a button that I put in my form bah it works, here is the code:

The Input forms :

<input xpath="message_content"/> <input xpath="@AEnumeration"/> <input label="Add" type="button"> <enter> <soapCall name="setMessageContent" service="tst:concatainer"> <param exprIn="message_content" type="string"/> <param exprIn="@AEnumeration" type="string"/> <param type="string" xpathOut="message_content"/> </soapCall> </enter> </input>

 And i Add this in my dataSchema :

<methods> <method library="tst:concatainer.js" name="setMessageContent" static="true"> <parameters> <param desc="message_content" inout="in" name="message_content" type="string"/> <param desc="A Enumeration" inout="in" name="AEnumeration" type="string"/> <param desc="The form" inout="out" name="self" type="string"/> </parameters> </method> </methods>

i create a javascript code "tst:concatainer.js"  this is the code of the JS :

function tst_concatainer_setMessageContent(message_content,AEnumeration) { return message_content+" "+AEnumeration }

 

1 reply

ParthaSarathy
Community Advisor
Community Advisor
June 19, 2023

Hi @anasspir05 ,

Create a OPEN type enumeration under /Administration/Platform/Enumerations/ and define it in your schema attribute.

 

Go to /Administration/Platform/Enumerations/ create new > Type: Open, and add the enumeration values eg, First_value, Second_value

 

Now in Data schema, call the above created open enumeration as userEnum

<attribute userEnum="AEnum" label="A" name="AEnumeration" type="string"/>

 Input form configuration is same as you mentioned.

 

Now when a user click on  AEnumeration drop down, the user can see 'first value' and 'second value' in dropdown. But If the user enter 'third value', a pop-up will ask 'Do you want to create value 'Third Value' in enumeration 'Aenumeration', and on Clicking Yes, this new value will get stored in enumeration as well as in schema. 

So when next user click on the same enumeration, he can see this new value as well in drop down

 

nms:recipient schema's 'City' field is one such example.

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 2
June 19, 2023

thank you for your reply @parthasarathy 
but my problem is that when I click on an element in the dropdown, I want that element to be displayed on my "Content" input,
if, for example, my "content" field contains the value "Hello This is my " ,
if I click on "First Value" in my dropdown, I want my "content" field to become "Hello this is my First Value".

Level 5
June 19, 2023

Hi @anasspir05 ,

This is very much related to use case of using JavaScript SOAP calls to validate form data from the Console.

Refer "Validate Values" section on this link https://experienceleague.adobe.com/docs/campaign-classic/using/configuring-campaign-classic/input-forms/editing-forms.html?lang=en

 

Below is example :-

 

This example shows how you can make service calls from within forms:

<enter>
  <soapCall name="client" service="c4:ybClient">
    <param exprIn="@id" type="string"/>
    <param type="boolean" xpathOut="/tmp/@count"/>
  </soapCall>
</enter>
 

In this example, the input is an ID, which is a primary key. When users fill the form for this ID, a SOAP call is made with this ID as the input parameter. The output is a boolean that is written to this field: /tmp/@count. You can use this boolean inside the form.

 

So in your case, what you are returning should be saved in your enumeration.

 

Note :- This is just a example and I am sure this approach will help you to achieve the use case, you just need to modify your use case accordingly.