Check some field before opening confirmation box in ODOO - odoo

I want to check that if some fields in the form view has been checked or not. If they have been checked then show a confirmation message and if not then a error message saying that those fields must be checked. For this functionality I have created a button which calls a specific function in the model. The button has also attribute confirm which enables the confirmation pop up box. But all the time it first opens the confirmation message and then the checking for the fields. I want to have the other way around how to achieve this. Please help.

Related

How to handle dynamic text with no div tags and no info where they are coming from in Selenium?

I have registration form for which I am trying to create a script.If we don't enter any value in any of the fields and click submit, it is showing a dynamic error message that "Please fill out this field!"
There is no div tag for this text. Moreover, if we click anywhere on the screen, it is disappearing. Can anyone tell, how to read this text?
Thank you.
When the field is marked as required, the Browser shows the message when the form is submitted. There is no way available for you to access it.
You can handle it within your test code by checking that all required fields are entered before submit is called.

Add cancel header to the HyperlinkTheme.xml file

Is there is any way to add a cancel event header to the theme file, so that i can configure the user cancellation event and display an appropriate message. so far i am getting a setup failed message even if the user cancelled the installation or any other failure occurred.
You can control the text on the confirmation message box displayed when the user clicks the cancel button. To do so, provide a custom .wxl file and change the ConfirmCancelMessage string. The default is:
<String Id="ConfirmCancelMessage">Are you sure you want to cancel?</String>
(See the src\ext\BalExtension\wixstdba\Resources\*.wxl files for examples).
However, in wixstdba, when the user clicks the cancel button during Apply(), wixstdba will always go to the failure page. That or the success page are the only two options today. There has been some discussion about extending the failure page to be more customizable but no work has been done on that idea.

How to clear textbox value?

In my CustomUI I am trying to validate the logon service account by entering the username and password. The Test button will validate the credentials. If it is an invalid account, it will show a spawndialog with an error, and on clicking will return to the same CustomUI. While returning back the username and password textbox value should be empty. What is the best way to clear out the textbox values? I tried by setting the property of the textbox value to empty, but the installer get failed.
On the close button control of your modal dialog you can put a set property control event that sets those properties back to empty. ( {} means empty in MSI ) Be sure to get the controlevent order correct so that the properties get set before the dialog is closed.
But, I'm not sure this will work. I'm not positive that the original dialog will refresh that data correctly. There are certain limitations of MSI UI and this might be one of those cases. (I'd have to mock it up to confirm. )
If you do his this limitation, the workaround is to do a NewDialog instead of a SpawnDialog and on that dialog tell the user there is a problem and only offer them a back button to the previous dialog.

Is it possible to have an extension library dialog box within a repeat control?

I'm running with an 8.5.3 UP1 server and I have a need to have many dialog boxes (for confirmation purposes) for a whole bunch of "action buttons" on an xpage. The code for these dialog boxes is almost exactly the same with the exception of the confirmation message being different and the client-side JS function they are calling if the Yes button is selected.
Since I really hate repeating code over and over, I was wondering if it is at all possible to put a xe:dialog control within a repeat control and specify the message and function call from an array of values? I know I can't compute the ID of the dialog control and without that I'm not sure how I would reference the dialog to open and close it.
Any ideas? Thanks
Yes, this is possible.
Make sure that you specify that the dialog box's property for keepComponents is set to False. You don;t have to do anything special for opening or closing the dialog box, just use whatever ID you give the dialog box in you client-side action to open the dialog box in the repeat such as XSP.openDialog('#{id:myDialog}')
The XPages renderer will automatically calculate the correct ID names for you.

Unable to handle confrimation box with selenium RC

i am trying to press the ok button from a confirmation box like this (i added Thread.spleep so i checked the button is pressed and the confirmation box is shown)
selenium.chooseOkOnNextConfirmation();
selenium.click("xpath=//a[contains(#href,'123')]");
assertTrue(selenium.getConfirmation().equalsIgnoreCase("123"));
but i get this
com.thoughtworks.selenium.SeleniumException: ERROR: There were no confirmations
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
at com.thoughtworks.selenium.DefaultSelenium.getConfirmation(DefaultSelenium.java:429)
Thx for your help.
I got the same error with the code
selenium.chooseCancelOnNextConfirmation();//点击cancel按钮
selenium.click("link=Delete");
selenium.getConfirmation();
Finally I find the reason is that the developer used the jconfirm function of jquery instead of window.confirm, and the jconfirm function is override with div.
Finally I used assertTrue(selenium.isElementPresent("id=popup_container")).
from this information it is hard to say exactly. but i will give you some info which will help you
java script generates 3 types of pop-up windows
1) Alerts
2)Confirmations
3)Prompts
your case, i guess
1) may be the statement selenium.click() you used, is not triggering the confirmation box
OR
2) if it is triggering, then it may not be the Confirmation box.it could be any one of the other 2 boxes
so, you must make sure manually what type of pop-up window it is and call the statements accordingly.
ex : Confirmation window : conatins OK and Cancel buttons
Alert window : contains only OK button
Prompt window : contains Textbox and OK and Cancel buttons
so check and use that commands respectively
if it is not the above case please the HTML code also