How to Pass Javascript Variable to Server (Local Variable) & Assign Value with Pop-Up

I really need your help in creating a Traditional Web program that my boss has given me, previously I made a post that also asked me about my program which was unsolved this previous post

Then, my boss returned to give directions that the form given must be dynamic. For example, when "Admin" enters text that has a pattern between {{example}}, then when "User" accesses the form the text example and all text that has a pattern between {{}} can be clicked and brings up a pop-up that can be filled in its value .

I'm really confused about it, because I made a static form with a format that already contained {{}} still didn't work, then was given dynamic form assignments.


This is the mock-up my boss wants


The concept of logic that I understand is

- create jquery that can take words containing {{}} and store them in a javascript variable

- javascript variables (client-side) that are obtained and then sent to the server and assign local variables (server-side) to store javascript variables

- With the local variable that has been obtained, then you we create the desired pop-up and value, but what I'm confused about is how to create a link that can direct the pop-up to the desired value condition is dynamic


So far I've done a number of things, like

1. find the word that created {{}} with jQuery then change it from the array object variable to the Json String

2. then send the Json string to the server using the technique from this page https://www.outsystems.com/forums/discussion/40098/how-to-assign-javascript-value-to-out-system-local-variable/

I assigned the Json string to the local variable string, because I did not find the local variable json

3. Next I use this tutorial to turn json into a list with local variable Agreement

https://www.outsystems.com/forums/discussion/55986/list-in-javascript/ 

However, when the action server will Deserialize, an error is encountered

Please help me, because I'm afraid that if I can't complete this task, my boss will fire me. Sorry, my English is bad, I use Google Translate


For more information, I put my OML file in the attachment

Hi Syamsu,

For de-serializing the JSON, you need to create a structure with attributes similar to that of the keys of the JSON. An easier way to create a structure with respect to JSON is to go to the data tab -> right click on the structures folder icon -> select "add structure from JSON" -> put the example JSON that you expect to be generated. This will create a structure compatible with the JSON that you are expecting. 

In the data type of the JSON, put the data type as that of the structure created in the above. You will not get an error while deserializing.

However I observed that the key:value pair that you have generated seems not correct. The key should not be any numeric digit in string format. It should be a some actual text. For example {"Param1":"name","Param2":"age"}. Otherwise the structure attribute names won't be created properly.

Hope this helps.

Regards,

Shounak


Shounak Devbhuti wrote:

Hi Syamsu,

For de-serializing the JSON, you need to create a structure with attributes similar to that of the keys of the JSON. An easier way to create a structure with respect to JSON is to go to the data tab -> right click on the structures folder icon -> select "add structure from JSON" -> put the example JSON that you expect to be generated. This will create a structure compatible with the JSON that you are expecting. 

In the data type of the JSON, put the data type as that of the structure created in the above. You will not get an error while deserializing.

However I observed that the key:value pair that you have generated seems not correct. The key should not be any numeric digit in string format. It should be a some actual text. For example {"Param1":"name","Param2":"age"}. Otherwise the structure attribute names won't be created properly.

Hope this helps.

Regards,

Shounak


 

Thank you for your answer, now I have succeeded to get a list or value of the results from jquery pattern {{}}


Then the result of the {{}} value pattern, I provide a navigate to pop-up link so that the value can be filled


Now, what I want to ask is how to replace the text expression containing {{value}} from the form with the result of the {{}} value pattern that has been given the link,


I haven't found a way or clue to do that, but I'm sure it looks like outsystems can do this, so I want to ask if it's the right way to replace the expression value with a list of records that have characters in the same {{}} string value

Hi Syamsu Rijal Efendi,

I guess this is what you are trying to build (not exact the same but almost)

See the sample app

Please let me know, if this what you are looking, will share the .oml solution shortly...


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Syamsu Rijal Efendi,

I guess this is what you are trying to build (not exact the same but almost)

See the sample app

Please let me know, if this what you are looking, will share the .oml solution shortly...


Regards,

Benjith Sam

 That's right brother, that's really the way the program I'm making, may I ask for the oml file or how to make it, because I'm still stuck in making it

 

Solution

Syamsu Rijal Efendi wrote:

 That's right brother, that's really the way the program I'm making, may I ask for the oml file or how to make it, because I'm still stuck in making it

Sure, Syamsu... Please find the attached .oml solution file. 

Note: I'm not sure whether the implemented approach is correct/optimized one or not.. if you build/find any optimized solution than the shared one please share the same with us :)


Hope this helps you!


Regards,

Benjith Sam

Solution