Developing Web Apps | Data Queries And Widgets II

Trying to improvise upon the exercise "6.6. Data Queries And Widgets II" in the course "Developing Web Apps"

Part of the exercise is to add participants to a movie with through a form widget.

I want to improvise the UX thus: instead of letting the user add a participant to the already set movie selected via the 'click on movie title' in the movies screen, I want to let the user change the selected movie via a combo box .. in case he accidentally clicked the wrong movie in the movies screen; instead of forcing him to navigate back to the movies screen and click on the correct movie, i want to let him change the movie within the 'add movie participants' screen via a combo box.

The combo box gets set with the movie that is clicked by the user in the movies screen i.e. he does not need to select it again. But if he makes an error, he can change it right from this screen.

I tried using the special list option of the combo box properties: added an expression to add the movie id of the clicked movie (clicked from movies screen) in the value 1 field, and another expression to add the title in the option 1 field, but getting an error. SEE ATTACHED IMAGE

Any way to achieve the end-result I want?

Image20210818at4.21.47PM.jpg

Solution

Hey there, in this case, i dont see the need to you to be using special list, because you want to get values from the database, in this case, movies and you can use the sort entity and get the movie id by selecting the movie on the combobox.

As you can see, I can select the movie I want to add crew now

What I did was:

Now what I am going to select is going to be saved on the variable MovieId, why? because when saving I will pass to my server action and it will know that I am adding a new person/role for that MovieId.


Don't forget that you will also need to refresh the aggregate to get the data based on the movie selected, in this case, you are going to refresh the title.

-On changing the movie, you are going to call the screen action OnChange.

- Inside of the screen action you are going to refresh the aggregate, getting the data based on the Movie(Id) selected and you are going to refresh also the title element

Let me know if I could help you.

Preview:

Kind Regards,

Márcio

OSMDb.oap

Thank you Marcio for your answer and all the screenshots and gifs.. much helpful.

Questions:

1. The variable MovieId is the input parameter to the screen yes?

2. Values in Input parameter variables can be changed? i.e. MovieId can be changed by selecting a different movie from the combo box?

2. What is "crew" in your ajax refresh in the OnChange action?

No problem @David Yisrael! :)

1- Yes it is.

2- The MovieId Variable, is getting the id of the movie selected when you are entering the screen, and you can also use it to select other movies. You just need to save the movie id selected to the variable MovieId. The movieId variable is going to change at the moment you are selecting other movies :)

3- Crew is just the name I gave to expression that holds the title of the movie. With that name I can do an ajax refresh on that element using that name as you can see I did on the screen action onchange


Kind Regards,

Márcio

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.