Hi,


I want to build a set of web blocks where which one wraps an data base entity for use in a web screen.

In this web screen I want to add two buttons, one to save other to continue.


Use case 1:

  • Press button "save" in web screen 
  • Each web block saves his inputs


Use case 2:

  • Press button "continue" in web screen 
  • Each validates his data
  • If every data is valid I go to the next web screen
  • If not I stay in the same screen and show the errors


I tried to use the Event module and the system built-in notify mechanism but I could not get a easy to understand implementation.


Can you share some ideas?


Regards



Hi Filipe,


One possibility is have a javascript function to click on a don't visible button inside of Web Block. But I don't know if is the best way.



Filipe Ventura wrote:

Hi,


I want to build a set of web blocks where which one wraps an data base entity for use in a web screen.

In this web screen I want to add two buttons, one to save other to continue.


Use case 1:

  • Press button "save" in web screen 
  • Each web block saves his inputs


Use case 2:

  • Press button "continue" in web screen 
  • Each validates his data
  • If every data is valid I go to the next web screen
  • If not I stay in the same screen and show the errors


I tried to use the Event module and the system built-in notify mechanism but I could not get a easy to understand implementation.


Can you share some ideas?


Regards



You need to have an input in each WB so that you can pass info to save or validate. (isValidade - boolean, isSave - boolean), these variables also need to be created locally on the parent screen  (where you have the WBs) to serve as the WB input.

When clicking, you'll notify the parent screen, and on notify action it'll assign the screen variables, refresh all WBs,

on the WB preparation, you can run validation or save depending on the inputs

You need to find a way to notify the parent screen if it is a validation, in that screen add a mechanism to verify if all WBs are valid, and finaly navigate or show Errors. If the error is also shown in the WB, you can also have an input to trigger it's showing :)

I'm not used to the events on WBs still, so that'd be my solution, but you can figure something similar using them :)

 

José Lopes wrote:

Filipe Ventura wrote:

Hi,


I want to build a set of web blocks where which one wraps an data base entity for use in a web screen.

In this web screen I want to add two buttons, one to save other to continue.


Use case 1:

  • Press button "save" in web screen 
  • Each web block saves his inputs


Use case 2:

  • Press button "continue" in web screen 
  • Each validates his data
  • If every data is valid I go to the next web screen
  • If not I stay in the same screen and show the errors


I tried to use the Event module and the system built-in notify mechanism but I could not get a easy to understand implementation.


Can you share some ideas?


Regards



You need to have an input in each WB so that you can pass info to save or validate. (isValidade - boolean, isSave - boolean), these variables also need to be created locally on the parent screen  (where you have the WBs) to serve as the WB input.

When clicking, you'll notify the parent screen, and on notify action it'll assign the screen variables, refresh all WBs,

on the WB preparation, you can run validation or save depending on the inputs

You need to find a way to notify the parent screen if it is a validation, in that screen add a mechanism to verify if all WBs are valid, and finaly navigate or show Errors. If the error is also shown in the WB, you can also have an input to trigger it's showing :)

I'm not used to the events on WBs still, so that'd be my solution, but you can figure something similar using them :)

 

Hi José,


You can use something like that with the Events Module.

You can trigger an event inside the web block and pass the operation (validate or save).The problem is:

  • There is no a simple way to know the result of the operation
  • And if the parent web screen needs to know the result to step forward there is no sinchronous way to do it (am i right?)

What do you think?


Regards.

Diogo Coelho wrote:

Hi Filipe,


One possibility is have a javascript function to click on a don't visible button inside of Web Block. But I don't know if is the best way.



Hi Diogo,


Yes, you can have something like that.

But how do you wait for the reply of the javascript function? ex: check if the fields are correct and return the result in a simple way?


Regards.


Hi Filipe,

You can achieve it using javascript.

Please follow below steps:

1. You need to place both button on each webblock and set extended property style "display:none" for both button.

2. you need to place both button in web page.

3. On click of save button of web screen need to click each webblock save button using javascript and on click of continue button of web screen  need to click each webblock continue button using javascript.


Regards

-SK-


Filipe Ventura wrote:

Diogo Coelho wrote:

Hi Filipe,


One possibility is have a javascript function to click on a don't visible button inside of Web Block. But I don't know if is the best way.



Hi Diogo,


Yes, you can have something like that.

But how do you wait for the reply of the javascript function? ex: check if the fields are correct and return the result in a simple way?


Regards.


Hi Filipe, 


Do you can use NotifyMessages between WB to know if validations are good or not. You can inform the parent if has passed the validations. 

This way has a small problem here, which is if you need to show the errors field by field is more difficult (but executable). You can put in the NotifiyMessage the fields with erros (for example with numbers).

If you need only the PopUp error message is the solution it's easy... you just need to know if has error or not.


Shashi kant Shukla wrote:

Hi Filipe,

You can achieve it using javascript.

Please follow below steps:

1. You need to place both button on each webblock and set extended property style "display:none" for both button.

2. you need to place both button in web page.

3. On click of save button of web screen need to click each webblock save button using javascript and on click of continue button of web screen  need to click each webblock continue button using javascript.


Regards

-SK-


Hi Sashi,


I understand your solution but there is one more question.


How can I get the result of the web block validation? 

Because, considering a submit I only want to go to the next screen if every web block is valid.


Regards.


Diogo Coelho wrote:

Filipe Ventura wrote:

Diogo Coelho wrote:

Hi Filipe,


One possibility is have a javascript function to click on a don't visible button inside of Web Block. But I don't know if is the best way.



Hi Diogo,


Yes, you can have something like that.

But how do you wait for the reply of the javascript function? ex: check if the fields are correct and return the result in a simple way?


Regards.


Hi Filipe, 


Do you can use NotifyMessages between WB to know if validations are good or not. You can inform the parent if has passed the validations. 

This way has a small problem here, which is if you need to show the errors field by field is more difficult (but executable). You can put in the NotifiyMessage the fields with erros (for example with numbers).

If you need only the PopUp error message is the solution it's easy... you just need to know if has error or not.


Hi Diogo,


There is a way of doing it, but there's nothing else?

Because if I only want to show the web block in readonly mode I need to implement the notify server action with nothing.


Other point. Check this example:

  • I validate the web block one and web block two
  • Both of then have invalid fields
  • Both launch the notifiy
  • The notify in the screen has one variable for each web block.
    • So web block one set variable one
    • And web block two set variable two
  • After this each one check the other variable
    • So web block one notify execution after update variable one, check if variable two is valid
    • And web block two does the same
  • After that if both variables are true I can click a button to go to the next screen

Can I be assured that I will not face concurrency problems?


Regards.