I need to do a partial refresh of multiple components as found here:
http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/Work_with_events_and_partial_or_full_refresh
So I figured I would start small with just one component and placed the code:
XSP.partialRefreshPost("#{txtProductType}");
In the on client side click event of a radio button group. When the page is displayed, I get:
The runtime has encountered an unexpected error.
Any idea what I am doing wrong?
The XSP.partialRefreshPost method requires a client side id and an optional argument. So in your case the correct syntax is:
XSP.partialRefreshPost("#{id:txtProductType}", {});
Related
One of my clients has a replica copy of a database on two different Domino Servers. On one of the servers if the user clicks on any white space on a view or form they get the following error:
While the database on the test server does not throw this error. My server likewise does not throw this error either. as far as I can determine they are both running the same release of Domino.
I have search my code but can't find any reason for this error.
Any pointers where to look.
Check for eventHandlers on your page, looking for one associated to a component that does not have an ID. I think what happens is that if you have an eventHandler on a button, comboBox etc that does not have an ID, it gets associated to whatever contains the button, comboBox etc. So it triggers when you click in that area.
If you find one, add an ID and it will resolve the click problem.
I'm not 100% sure what the refreshId issue is, maybe the eventHandler in question is set refreshMode="partial" but not refreshId set, so it's trying to refresh the component containing the eventHandler, which is the one that doesn't have an ID. I could understand how that would cause a problem.
I have issue from client end with jsf 1.2 as explained below
I am navigating on click on command button to the url below
test/editProject.jsf?value=123
If any field are missing I am using addErrorMessage('id','string') and returning fail in validation method. The error message is displayed under that component.. I am fine till this..
The problem is the url is displayed as
test/editProject.jsf
Here the value queryString is missing..if the user correct the error and click on save it works fine..it is working as per jsf cycle
Issue
My client is pressing enter on the browser url tab which has the url test/editProject.jsf. I told him to use F5 button to refresh but he didn't agreed.. any idea how to retrieve the query string back on getting error message.
I have used redirect in my project but I think here its not good idea to use..
Please let me known if you any solution for this..
Thanks for help.
I don't know how helpful my query is to understand the problem. Actually i am working on an application. The flow is i have a jsf page where two combo boxes are present. Once is select option-1 the second combo gets populated. Then we press the next button and based on second option, second jsf page is loaded. Now when i go the second page and refresh, it pushes me back to the first page and gives a validation error. I am unable to understand what's happening. Any points would be helpful. I am attaching the screen shots below.
Any pointers would be helpful.
Ben
Trigger full refresh when logged out in 8.5.3. I don't care if the data is lost, I just want to trigger full refresh if partial refresh fails in case user is logged out or session has timed out.
I have two windows open. If I press the logout button on window 2, and then come back onto window 1 and try to do a partial refresh, it returns nothing (just blank value for that control). So how can I trigger a full refresh when the user is logged out?
I tried onComplete, onStart and onError client side events, but cannot figure out how I could find out when this logout has happened, I tried the following code:
var strUserName = '#{javascript: #Name("[CN]", #UserName());}';
alert("Start: " + strUserName);
It always returns the username rather than anonymous in window 1, even when user is logged out in window 2!
onError event never fires when partial refresh fails or returns blank value.
Any ideas or help would be greatly appreciated.
Did you try to lock the database down (Anonymous = NoAccess)? Then you should get an 404 and the error routine fires.
Update
You can:
add a redirect meta header to the page that kicks in when a session expires (cheapo solution, but might catch already most used cases)
Still lock down the database but give Anonymous the right "view public pages" and then have the page(s) that anonymous is allowed to see marked with the attribute "available for public access"
Make sure your partial refresh checks if nothing comes back and reloads the page then (most work since you need to alter business logic) - some sample of your code would be needed
onComplete has one weakness. The value bindings are evaluated when the page is rendered, not after a partial refresh, as you might think. This is due to the way the request works. When a request is sent, the callbacks for the request are bound (onStart,onComplete, etc.). Therefore the client side handler code has to be available before the refresh happens.
If the partial refresh doesn't refresh the item with the event handler(onComplete/onStart/onError), I think the value binding is only updated on page load.
There are several ways to solve this.
Have a client side function that does partial refresh on a hidden (by CSS) xp:text/etc. that shows the current user name. Fetch the content using theNodeReferenceVariable.innerHTML. If Anonymous is the current user:
document.location.href = document.location.href
You could also do document.location.reload(), but that might result in submits being resent.
Use the XPages Extension Library REST services. Same as above, if Anonymous, reload page.
We're using the "Error Messages" XPages (native) control to show the validation errors to user. It works. The validation is done by setting the field as required and entering the field error message. Nothing special.
Now the requirement is to set the error messages in to the same order as they appear in the form. Is this possible?
I guess I could create a custom validator (Java) and doing all the form validations there in certain order (just tested the Validation interface... but not really used id, yet).
There's the old (unresolved) argument: should the errors appear next to the control that failed the validation, on top of the form or next to the button you pressed for submission. I tend to put them next to the failed control and have ONE message next to the button reading: "Sorry I couldn't process the input, help me and fix the fields that have error messages next to them". Then sequence isn't an issue any more. If you want to be 100% sure you could instead of the summary control use the individual controls next to each other.
What anyway would be a nice exercise: let the error message control alter the css of the failed control, so it becomes clearer what to look out for.
The Validations are fired one by one in order they are in the component tree. Depending on how you are wanting them to display you could move the components around and then style them with css. Or if you are really just wanting to move the order of the summary statements around in the Messages Box, I would just use some JS to move them around I believe they just render as a UL. Only having one Validator won't really work as the same validator will get fired for every component in the order of the component tree.