So I have to refresh a page after having a user put new inputs into some fields that were successfully sent to the database. That refresh has to reflect the new values inserted to the page. So my problem is I have a call happening. After that call the database updates. I then have a refresh to refresh the container of the form. The problem is it's assigning the old values stored within the local variable to the refreshed page. Now I was told I shouldn't have two calls, one to bring in the original info and one to bring in the updated. I should just have one which is the original. So how would I go about bringing to the front this newly entered information.

Hello Jaret,


Try this steps:

Regards.

Hi Jaret

Jaret Sanchez wrote:

So I have to refresh a page after having a user put new inputs into some fields that were successfully sent to the database. 

Ok. First question. If the user just did set the values in the inputs, what are you trying to refresh?
Are you moving from the Screen to a new one? Are you trying to change what is in the form?

How is the request being made? Ajax Submit? Submit? Is it even Traditional Web or is it Reactive or Mobile application?

Jaret Sanchez wrote:

That refresh has to reflect the new values inserted to the page. 

Again, where are coming the values? Same page? Different page? Where are the new values stored? 


Jaret Sanchez wrote:

So my problem is I have a call happening. After that call the database updates. I then have a refresh to refresh the container of the form. The problem is it's assigning the old values stored within the local variable to the refreshed page. 

What is a "call"? Is it a request for a Screen Action? Is it a call (server action API method) inside a Screen Action? 


Jaret Sanchez wrote:

Now I was told I shouldn't have two calls, one to bring in the original info and one to bring in the updated. I should just have one which is the original. So how would I go about bringing to the front this newly entered information.

Could you explain what are those "calls"? 

In any case, once a Form is loaded, any request to the server from the page (Submit or Ajax Submit, if this is a Traditional Web Application), will not make the Form "update" its data (Record) with new data. Doesn't matter if you use Submit (that refreshes the entire page), or if you use a Data Refresh and Ajax Refresh (on an Ajax Submit). The Form will not replace its "actual" record data with new data from its source. It will keep using its own data.

You need first to assign new values to the Form Record Manually (in your code) and then refresh the Form. Only then the form will be refreshed with the new values you stored in its Record.

Hi friend. 

I don't understand exactly what you need to do.

If you just need to pass the value through screen, if these values are simple short strings or id, use a session variable. 

Can you explain better?

Eduardo Jauch wrote:

Hi Jaret

Jaret Sanchez wrote:

So I have to refresh a page after having a user put new inputs into some fields that were successfully sent to the database. 

Ok. First question. If the user just did set the values in the inputs, what are you trying to refresh?
Are you moving from the Screen to a new one? Are you trying to change what is in the form?

How is the request being made? Ajax Submit? Submit? Is it even Traditional Web or is it Reactive or Mobile application?

Jaret Sanchez wrote:

That refresh has to reflect the new values inserted to the page. 

Again, where are coming the values? Same page? Different page? Where are the new values stored? 


Jaret Sanchez wrote:

So my problem is I have a call happening. After that call the database updates. I then have a refresh to refresh the container of the form. The problem is it's assigning the old values stored within the local variable to the refreshed page. 

What is a "call"? Is it a request for a Screen Action? Is it a call (server action API method) inside a Screen Action? 


Jaret Sanchez wrote:

Now I was told I shouldn't have two calls, one to bring in the original info and one to bring in the updated. I should just have one which is the original. So how would I go about bringing to the front this newly entered information.

Could you explain what are those "calls"? 

In any case, once a Form is loaded, any request to the server from the page (Submit or Ajax Submit, if this is a Traditional Web Application), will not make the Form "update" its data (Record) with new data. Doesn't matter if you use Submit (that refreshes the entire page), or if you use a Data Refresh and Ajax Refresh (on an Ajax Submit). The Form will not replace its "actual" record data with new data from its source. It will keep using its own data.

You need first to assign new values to the Form Record Manually (in your code) and then refresh the Form. Only then the form will be refreshed with the new values you stored in its Record.


The screen the user will come into will be an uneditable screen detailing information about a record. Upon clicking an edit button you can change the data within that page. Such as the current status of a user. Choosing if that user is a winner, and also the date they won on. So originally, after a user changes that information that page needs to make another call "Server action API method" after the user inputs new changes. Which then will retrieve the updated data and reflect that on the same page while the fields will then become uneditable. But my mentor says two calls are unnecessary. The only thing is the refresh widget only brings back the old data for some reason and doesn't replace it with the new input data.

Ok.

Are the "view" and the "edit" mode both using the Form?

If so, indeed you don't need to refresh the Form after saving the data, once the Form is already holding the most up to date information, the one you used to save to database.

Refreshing a form does not make the form fetches data from its source. Forms only fetch data from its source on Page Load (when you are navigating to the page).

If you need to change the data a Form is showing, you need to use an assign and set its record with the new data you want it to change, before doing the Ajax Refresh of the Form 

Eduardo Jauch wrote:

Ok.

Are the "view" and the "edit" mode both using the Form?

If so, indeed you don't need to refresh the Form after saving the data, once the Form is already holding the most up to date information, the one you used to save to database.

Refreshing a form does not make the form fetches data from its source. Forms only fetch data from its source on Page Load (when you are navigating to the page).

If you need to change the data a Form is showing, you need to use an assign and set its record with the new data you want it to change, before doing the Ajax Refresh of the Form 

Okay well, upon changing the status to either active 1, or an archived 2 the local variable holds that new identifier. With that it sends it to the API method service action request and it understands that if I set 2 it is now "archived". But if I try and assign that same variables data to the refreshed screen page it will just show up as an integer. I need a description to be there, such as "archived" instead of the identifier that represents it. The winner and winner date are easy since those hold the values I need to reflect. The identifier though is just and identifier and wont replace itself on the UI side as it's description instead of itself. So how do I bring up the identifiers description instead of the Id itself in that situation?


Eduardo Jauch wrote:

Ok.

Are the "view" and the "edit" mode both using the Form?

If so, indeed you don't need to refresh the Form after saving the data, once the Form is already holding the most up to date information, the one you used to save to database.

Refreshing a form does not make the form fetches data from its source. Forms only fetch data from its source on Page Load (when you are navigating to the page).

If you need to change the data a Form is showing, you need to use an assign and set its record with the new data you want it to change, before doing the Ajax Refresh of the Form 

And the edit and view are on the same page. But upon clicking edit the status description disappears and the ability to choose from the different statuses appears. Upon clicking cancel or save the choices disappear and the status description reappears.