Why does my error message display quickly, then disappear right away - xpages

I have a save button on my xpage. I have field edits inside of the button. I did that because when I put the edit in the field validation, it runs when I open a new xpage. Either way though, I have an Error Message control on the form. When I click the save button, it flashes yellow then disappears. Why is this occurring? It's simple code:
if(getComponent("ExpAmt").getValue() == null) {
#WarningMessage("You must enter an Amount for this expense");
return false;
}
Partial refresh message box displays saying:
An error occurred while updating some of the page.
Unable to load http://localhost/DB.nsf/xpForm.xsp?$$ajaxid=view%3A_id1%3A_id3%3A_id4%3ApanelAll status: 0

There is a partial refresh in your ccApplicationLayout that runs onClientLoad. It was immediately refreshing the panel after the page was loaded which caused the flashing effect. Removing this solved the issue.

Related

How to cancel all downloads in Chrome extensions and avoid displaying Save As dialog?

I'm trying to cancel every download just as they are started.
Here's my code so far:
var downloadCreated = function (a) {
// cancel the download
chrome.downloads.cancel(a.id);
chrome.downloads.erase({id: a.id}, function (d) {
});
};
chrome.downloads.onCreated.addListener(downloadCreated);
I've set Chrome to display Save As dialog when downloads are about to start.
I run my extension and click on a link several times. Sometimes the download is simply cancelled (which is the exact behavior that I want), and sometimes the Save As dialog is displayed. Clicking on Save button in the dialog has no effect and nothing will be downloaded. Whether the dialog is shown or not is random.
I'm just trying to avoid displaying the Save As dialog by any means.
Do you guys know a solution for this?
I found the solution some time ago but forgot to provide the answer. Here it is:
To stop a Chrome download attempt, chrome.downloads.cancel should be called in the proper event, that is chrome.downloads.onDeterminingFilename. That's it! No useless save dialogs will appear.

altering DOM in beforeunload in Chrome

Is it possible to alter DOM in beforeunload handler? Chrome seems to apply DOM modifications after the user pressed "stay" in browser alert about leaving the page, and I want a part of the page to be hidden while this alert is visible.
See the demo:
<script>
window.onbeforeunload = function(e){ document.getElementById('a').style.display = "none"; e.returnValue = "adios";}
</script>
<div id=a >This text should disappear when the user tries to leave the page</div>
https://jsfiddle.net/qmatic/6sLp7rmq/
The only solution I have so far is to animate the div to opacity:0 and to have a code in setInterval that constantly resets this animation. While the code is running the div is always visible. Chrome stops all the code when it shows an alert, so the animation finally runs till the end and hides the div. But it's a terrible solution - I'm constantly updating the DOM to reset the animation. Does anyone have any better ideas?
The process being executed by Chrome appears to be:
1) call the handler, waiting synchronously for its return value
2) if the return (event.returnValue) is suitably undefined, continue the unload
3) otherwise present a modal popup of some kind, getting the user's permission to cancel the navigation.
4) if navigation is cancelled, stay on the page and apply a refresh cycle to the page view.
I have stepped through an onbeforeunload handler in the debugger, and when I do so, style changes WILL take effect before the modal dialog appears instead of after it closes. This seems to indicate that using the debugger introduces additional DOM refresh cycles that would otherwise not occur in normal running. I am trying to find a way to get one of these refresh cycles to occur programmatically from within the handler, but so far no luck.
In other browsers, there seems to be refresh cycles inserted between steps 1-4 above, giving the desired behavior.

Click update after dialog appears Robotframework

I'm testing a scenario where I click on a button and below dialog appears. It's only possible to click on 'Update'
I have put following in my test scenario:
Click Element jquery=a.newOrder
Click Element Link=Update
I receive following error message after running the test:
Element is not clickable at point (1023, 127.19999694824219). Other element would receive the click:
The only HTML code that is related to the Update is
Update
I also try to test this with alert but no alert is found...
Can someone explain me what I need to do?
Thanks!
Explaining your scenario :
When you click update, a pop will be shown. You have to add a Wait until page contains element in any of the elements in pop up and then wait for the element you need to click. After the element is visible and focus is on the element. Click the element. If you get error in this, try to add selenium timeout for command execution speed or add a sleep to check whether the element loads slowly.

ZK: Modal window not working properly when exception is thrown

The problem I have is pictured in this fiddle I created:
If you click on the Order coffee button, I've forced a Runtime Exception to be thrown within the doAfterCompose method of the modal window's controller. As you can see the modal window gets appended at the bottom of the page. This, aside from being ugly, allows the user to click again the Order Cofee button, which causes the famous "Not unique ID in space" error.
Is there any way to prevent the window from being created when an Exception is thrown?
You can call setPage(null) method on your component.

How to make popUp not submit form on startup?

I am using JDeveloper 11.1.2.3.0,
I have a createInsert button that has ShowPopUp Behavior operation included. In the popUp I have inserted a form whose attributes will be clean from the createInsert operation. When I click the button the popUp shows up all right but showing an error about the mandatory fields of the form. The fields of the form of course are empty because I just opened it. So I think that the popUp is autoSubmiting the form at the starting point.
Does anyone have an idea how to stop it from doing this?
I have changed the createInsert button PartialSubmit property to false but nothing changed.
Ok found the solution. The popUp was not submitting anything actually but during the CreateInsert operation the iterator opens a new row in every related component within that page (form, table etc). So when my popUp opened up with the new form fields, a new row was being created in the back-stage in my read-only table. I changed the iterator in a new one from another Application Module for each case and everything is fine now.

Resources