Control the visibility of elements in the BookingDetail Screen

Control the visibility of elements in the BookingDetail Screen

  

hello,

 have a question about how to enable a Button and a label to be shown after the specific button was clicked?


this is what I require to do: 


a) Make sure that the line that displays the Room Number and the Room Price in the Form, is only displayed after clicking on the Get Available Room Button and successfully finding the cheapest Room available.

b) Make sure that the Book Room Button is only shown after clicking on the Get Available Room Button. 

Ghada Alhadlaq wrote:

hello,

 have a question about how to enable a Button and a label to be shown after the specific button was clicked?


this is what I require to do: 


a) Make sure that the line that displays the Room Number and the Room Price in the Form, is only displayed after clicking on the Get Available Room Button and successfully finding the cheapest Room available.

b) Make sure that the Book Room Button is only shown after clicking on the Get Available Room Button. 

In the Booking Project

Assignment 5: Data Queries & Widgets

2. Control the visibility of elements in the BookingDetail Screen


Solution

Hello,

The two tasks that you want to accomplish have a similar solution.

In the Button Book Room, you have a Visible property, that you can use to define a condition where the button is visible. 

When you click the Get Available Room Button, you get the cheapest available room. So, you can use that info in to set the Visible property accordingly, to display the button ONLY when you get an available room after you click the Button.

For the Room Number and the Room Price row, you can enclose that info in a Container and also take advantage of the Display property of the Container. It works in a similar fashion than the Visible property of the Button. 

There are different ways to solve this problem, so I will let you try to see if you can do it. Let us know if you need more help.

Best regards,

Jorge Costa


Solution

Jorge Costa wrote:

Hello,

The two tasks that you want to accomplish have a similar solution.

In the Button Book Room, you have a Visible property, that you can use to define a condition where the button is visible. 

When you click the Get Available Room Button, you get the cheapest available room. So, you can use that info in to set the Visible property accordingly, to display the button ONLY when you get an available room after you click the Button.

For the Room Number and the Room Price row, you can enclose that info in a Container and also take advantage of the Display property of the Container. It works in a similar fashion than the Visible property of the Button. 

There are different ways to solve this problem, so I will let you try to see if you can do it. Let us know if you need more help.

Best regards,

Jorge Costa


I solve it by adding this condition to each of them

BookingForm.Record.Room.Price <> 0

and add refresh data and tow ajax refresh for container and for the button
before the end of get available room action

but I did not know if there is better then this solution or not


hi Ghada,

Do not use that visibility property as a browser can change its value. You can use the enable property, or use IF widget to include the button or not.

regards,

I

Hello,

Yes, that's it! Using Ajax Submit, you need to Ajax Refresh the Container and Button so that they appear after you get the cheapest room.

Regarding the condition, there are many possibilities, depending on the logic you are implementing. If everything appears as it should after you get the cheapest room, then you are fine :) 

Best regards

Jorge Costa wrote:

Hello,

Yes, that's it! Using Ajax Submit, you need to Ajax Refresh the Container and Button so that they appear after you get the cheapest room.

Regarding the condition, there are many possibilities, depending on the logic you are implementing. If everything appears as it should after you get the cheapest room, then you are fine :) 

Best regards


thank you Jorje.


But why when I change the method to Ajax Submit my input validation does not work!

Ghada Alhadlaq wrote:

Jorge Costa wrote:

Hello,

Yes, that's it! Using Ajax Submit, you need to Ajax Refresh the Container and Button so that they appear after you get the cheapest room.

Regarding the condition, there are many possibilities, depending on the logic you are implementing. If everything appears as it should after you get the cheapest room, then you are fine :) 

Best regards


thank you Jorje.


But why when I change the method to Ajax Submit my input validation does not work!

Yes, you also need to refresh the Form, when the validations fail, otherwise the validation messages do not appear.

Best regards

Gede wrote:

hi Ghada,

Do not use that visibility property as a browser can change its value. You can use the enable property, or use IF widget to include the button or not.

regards,

I

Hi Gede,

That is true in the Display property of the Container, but not on the Visible property of the Button. The Visible property is just like if you were using the If Widget to control the visibility.

In the case of the Container, and the Display property, the HTML is generated and it has the possibility of having those values tampered. So, using the If widget to control the visibility is indeed safer. 

The suggestion of using the Enable property actually has the same problem than the Display, and it has the extra problem of not hiding the Widget at all. Just disables it. So, in the case of a Button, the Button would still appear on the page, but it would not be clickable. And just like the Display, the HTML of the Button would be generated, so it is also possible to change its value.

Best regards,

Jorge Costa wrote:

Ghada Alhadlaq wrote:

Jorge Costa wrote:

Hello,

Yes, that's it! Using Ajax Submit, you need to Ajax Refresh the Container and Button so that they appear after you get the cheapest room.

Regarding the condition, there are many possibilities, depending on the logic you are implementing. If everything appears as it should after you get the cheapest room, then you are fine :) 

Best regards


thank you Jorje.


But why when I change the method to Ajax Submit my input validation does not work!

Yes, you also need to refresh the Form, when the validations fail, otherwise the validation messages do not appear.

Best regards

I have added the refresh to the form but also it's the same

the validation still not working 

Here is the action of 

GetAvailableRoom


Ghada Alhadlaq wrote:

Jorge Costa wrote:

Ghada Alhadlaq wrote:

Jorge Costa wrote:

Hello,

Yes, that's it! Using Ajax Submit, you need to Ajax Refresh the Container and Button so that they appear after you get the cheapest room.

Regarding the condition, there are many possibilities, depending on the logic you are implementing. If everything appears as it should after you get the cheapest room, then you are fine :) 

Best regards


thank you Jorje.


But why when I change the method to Ajax Submit my input validation does not work!

Yes, you also need to refresh the Form, when the validations fail, otherwise the validation messages do not appear.

Best regards

I have added the refresh to the form but also it's the same

the validation still not working 

Here is the action of 

GetAvailableRoom


Hello,

The Ajax Refresh of the Form should also be when the validations fail. You only see the validation message, if one input of the form is not valid. 

You are just refreshing the Form, when the validations pass and everything is ok. You are missing the part of refreshing the Form when the inputs are not valid.

Hope it helps.


Jorge Costa wrote:

Ghada Alhadlaq wrote:

Jorge Costa wrote:

Ghada Alhadlaq wrote:

Jorge Costa wrote:

Hello,

Yes, that's it! Using Ajax Submit, you need to Ajax Refresh the Container and Button so that they appear after you get the cheapest room.

Regarding the condition, there are many possibilities, depending on the logic you are implementing. If everything appears as it should after you get the cheapest room, then you are fine :) 

Best regards


thank you Jorje.


But why when I change the method to Ajax Submit my input validation does not work!

Yes, you also need to refresh the Form, when the validations fail, otherwise the validation messages do not appear.

Best regards

I have added the refresh to the form but also it's the same

the validation still not working 

Here is the action of 

GetAvailableRoom


Hello,

The Ajax Refresh of the Form should also be when the validations fail. You only see the validation message, if one input of the form is not valid. 

You are just refreshing the Form, when the validations pass and everything is ok. You are missing the part of refreshing the Form when the inputs are not valid.

Hope it helps.


I get your point and it works now, thank you.


I have another issue if you could help me with it, I will appreciate that.  

I do it, but when I click  Save & New Button the ComboBox don't clear their value to the default one


 Assignment 5: Data Queries & Widgets

the last part of Extra Challenge

As you probably realized by now, to add several Amenities to a Room you’re forced to navigate multiple times between the RoomAmenities Screen and the RoomDetail Screen. To change this, create an additional Save & New Button in the RoomAmenities Screen. This way, instead of going back to the RoomDetail Screen, simply clear the input to allow you to add a new Amenity to the Room, without closing the Screen.


Hello,

You need to "reset" the variable associated to the combo box, when you click on the Save & New Button. Otherwise, when you click on Save & New, the combo box will have the value that you selected before saving. 

In the Save & New Action, right after you save the Amenity information in the database, you can use an Assign to change the value of that variable to its default value, or to any other value that you want it to have. 

Hope this helps,


Ghada Alhadlaq wrote:

Jorge Costa wrote:

Ghada Alhadlaq wrote:

Jorge Costa wrote:

Ghada Alhadlaq wrote:

Jorge Costa wrote:

Hello,

Yes, that's it! Using Ajax Submit, you need to Ajax Refresh the Container and Button so that they appear after you get the cheapest room.

Regarding the condition, there are many possibilities, depending on the logic you are implementing. If everything appears as it should after you get the cheapest room, then you are fine :) 

Best regards


thank you Jorje.


But why when I change the method to Ajax Submit my input validation does not work!

Yes, you also need to refresh the Form, when the validations fail, otherwise the validation messages do not appear.

Best regards

I have added the refresh to the form but also it's the same

the validation still not working 

Here is the action of 

GetAvailableRoom


Hello,

The Ajax Refresh of the Form should also be when the validations fail. You only see the validation message, if one input of the form is not valid. 

You are just refreshing the Form, when the validations pass and everything is ok. You are missing the part of refreshing the Form when the inputs are not valid.

Hope it helps.


I get your point and it works now, thank you.


I have another issue if you could help me with it, I will appreciate that.  

I do it, but when I click  Save & New Button the ComboBox don't clear their value to the default one


 Assignment 5: Data Queries & Widgets

the last part of Extra Challenge

As you probably realized by now, to add several Amenities to a Room you’re forced to navigate multiple times between the RoomAmenities Screen and the RoomDetail Screen. To change this, create an additional Save & New Button in the RoomAmenities Screen. This way, instead of going back to the RoomDetail Screen, simply clear the input to allow you to add a new Amenity to the Room, without closing the Screen.






Hello,

I try to do this but my variable is an ID of a Statice Entity and my default value is -1 which is (Select Amenity)

so I could not assign the ComboBox variable to -1



Jorge Costa wrote:

Hello,

You need to "reset" the variable associated to the combo box, when you click on the Save & New Button. Otherwise, when you click on Save & New, the combo box will have the value that you selected before saving. 

In the Save & New Action, right after you save the Amenity information in the database, you can use an Assign to change the value of that variable to its default value, or to any other value that you want it to have. 

Hope this helps,





Ghada Alhadlaq wrote:

Hello,

I try to do this but my variable is an ID of a Statice Entity and my default value is -1 which is (Select Amenity)

so I could not assign the ComboBox variable to -1



Jorge Costa wrote:

Hello,

You need to "reset" the variable associated to the combo box, when you click on the Save & New Button. Otherwise, when you click on Save & New, the combo box will have the value that you selected before saving. 

In the Save & New Action, right after you save the Amenity information in the database, you can use an Assign to change the value of that variable to its default value, or to any other value that you want it to have. 

Hope this helps,





Hi Ghada, 

This really depends on your logic. I assume that the (Select Amenity) option is a Special List Value. If it is, that value is not saved in the Combo Box Variable. When (Select Amenity) is chosen, the Combo Box Variable will maintain its Default Value. 

So, after you save the Amenity in the Database, you need to assign your Combo Box Variable to its default value, to "clean" it. If you have your Combo Box Variable to be something like this... 

... then, its Default Value is NullIdentifier(). This means that your assign should be AmenityId = NullIdentifier(), to "reset" its value. 

By resetting the Combo Box Variable, after clicking the Save and New Button, the Combo Box will not assume any value and it will appear as if you were entering the page for the first time.

Hope this helps.