Data from web-screen to web-block

Data from web-screen to web-block

  

Hello All,

Most of us know how to pass data from web-block to web-screen with the help of notify and notifyMessage.

Does anyone knows how to pass the data in any form from web-screen to web-block?

Thanks, 

Beeta






You can do this by using input-parameters in your webblock.

The "OutSystems" way for doing this is through Input Parameters, like Joost mentioned.

You must remember that you need to "refresh" the web block, through an Ajax Refresh, if the action was called through an Ajax Submit. A submit, when rebuilding the whole page, will automatically refresh the web block.

Also, keep in mind that you will lose any internal state to the web block.

Cheers.

Okay, Thanks, Joost and Eduardo.

I have one doubt, I'm giving an input box to the web-screen in which I'm getting the data from the entity. I want to edit the data in that input box and send that edited data to the web-block.

How can I achieve this?

Can somebody explain?



Do you also want to update the entity when you change the value in the input box?

If not: create a screen-variable and attach it to the inputbox. In the preparation you give the variable the value from the entity. You can pass this variable to the webblock on the change event of the inputbox.


Otherwise just attach the entity-value on the intputbox and pas the value of it to the webblock.

Hi Beeta,

You can achieve this through passing input parameter to webblock, when you edit the value in input box you need to refresh the webblock to get updated value from inputbox from web screen. To refresh the webblock you can call the on change of input box of web screen.


Regards

-SK-

Shashi kant Shukla wrote:

Hi Beeta,

You can achieve this through passing input parameter to webblock, when you edit the value in input box you need to refresh the webblock to get updated value from inputbox from web screen. To refresh the webblock you can call the on change of input box of web screen.


Regards

-SK-

Hi Shashi,

Just beware that the OnChange will be triggered as soon as the user tops typing for a few milliseconds (300?).
So, you need to validate the value before trying to update the web block.

Cheers.


Beeta Sahoo,

What is your "use case"? What is that you are trying to achieve?
Depending on your requirement, maybe there are other possible solutions that suit you better?

Cheers.

Thanks, Shashi, Eduardo for your replies.

My use case is:

 I'm having a form data on the web-screen and as you suggested I will pass those form data as an input parameter in the web-block which I'm using on the screen. There is another set of list of data in the web-block which I'm taking it from an entity and which is editable by the user. There is a button in the web-block "submit". So on submit, there is an action called an inside action, I'm serializing both the data (ie.. the form data from web screen as an input parameter to the web-block and the list of editable  data which is there in the web-block) and serializing those data and storing in one of the attributes of an entity. 

any suggestions?



Hello Beeta

1. Why are you serializing all the info and storing in a single attribute?

2. Why are you using a web block? Can't all the inputs be in the page?

Cheers

Hey Eduardo,

Ans 1: The API that I'm calling accepts only JSON values within the entities. That's why I have a restriction on making more entities due to data security.

Ans 2: Our UI team has made a list of an accordion and each accordion has several input variables which act as list records which the user needs to edit. we may do this inside the screen but even I'm not sure that why they are doing inside web-block. but thats the thing.

Ok. If you can't change the layout, you are stuck doing the way it was suggested.
Eventually you can do the opposite, that is to keep everything in the page, and the web block send the information to the page when it is entered, and so, you can control in a single place all the info (but this will require same or more logic).

Pay attention that having the web blocks is mandatory if you want to show a LIST inside a LIST, but if this is not the case, you can have the accordions directly into the page, instead of blocks, and this would make the logic much easier keeping the interface.

Cheers