In richfaces form based error message possible? - error-handling

I would like a catch-all display of any errors or exceptions. For instance I would like to catch 500 responses to AJAX requests and display the summary in a text field. More so I would like a single message area for the entire form (w/o specifying a separate message tag for every input or button). How can this be implemented using richfaces?
I've read the documentation located at the richfaces demo site, but the 500 responses still get through.

For displaying all validation errors in your form in a single location use the <rich:messages/> component instead of the <rich:message> as shown in: http://livedemo.exadel.com/richfaces-demo/richfaces/messages.jsf

As I look around I think my paradigm is wrong. I was thinking I would catch an HTML error code on return, but it looks like richfaces catches it server side and turns it into a page to display the details on the front end. I'll look into how to set up faces-config to redirect to one of my classes or maybe just create an attribute in the bean that I set to the message in a catch block.

Related

Force GET_ONE request when navigating to Show page

As I believe is common in many APIs, ours returns a subset of fields for a record when it is part of a List request, and more details when it is a single-record request to its Show endpoint.
It seems that react-admin attempts to avoid doing a second request when loading a Show page (possibly re-using the record data from List?), which results in missing data. Refreshing the page fixes this, but I'm wondering if there is a setting that will force a GET_ONE request on every Show page load.
There are no setting for that. However, this should be achievable with a custom saga which would listen to LOCATION_CHANGE action (from react-redux-router) and dispatch a refreshView action (from react-admin) when the new location pathname ends with /show.
Edit: however this is very strange. We only use the data we already got from the list for optimistic display but we still request with a GET_ONE when navigating to a show page from the list. Do you have a codesandbox showing your issue?

MVC unobtrusive general message

Im working in a project where the validations messages with unobtrusive system works fine.
When any attribute is uncompleted or wrong the proper error messages appear, at client side ofc.
The problem is the following. I need to set an general error message at the top of the site (besides to each field validation message error). I know i can use #Html.ValidationSummary but i dont want the list of fields, what i need is one general message telling the user that there is something wrong with the form.
Regards.
Edit: On jquery before submit i'm doing $("#frmSubmit").valid();
Did you try using the ValidationSummary(bool) overload? Supplying true excludes property errors.
Why not just have check ModelState on your view like this:
#if (!ViewContext.ViewData.ModelState.IsValid)
{
<div>Your error message here...</div>
}
Then style your div to be errorish...

Mechanical Turk externalquestion error when submitting hit

I have managed to create a HIT with an external question that calls an html file hosted in an S3 server. I have worked in the sandbox environment. When I create the hit, I get the following error when I try to submit the hit as a worker:
There was a problem submitting your results for this HIT.
This HIT is still assigned to you. To try this HIT again, click "HITs Assigned To You" in the navigation bar, then click "Continue work on this HIT" for the HIT. If this problem persists, you can contact the Requester for this HIT using the "Contact" link above.
To return this HIT and continue working on other HITs, click the "Return HIT" button.
I have already read multiple forums trying to figure out the problem. When I check out the source in the developer tools, it seems to have all the necessary parameters set:
</style><iframe height="400" scrolling="auto" frameborder="0" align="center" src="https://BUCKET.s3.amazonaws.com/index.html?assignmentId=34J10VATJGBKANG4MDCHRA6ME53QIH&hitId=3N2YPY1GI6BYD6C5MRBYOYBJJSEEVE&workerId=A1YJU5SNGQQP00&turkSubmitTo=https%3A%2F%2Fworkersandbox.mturk.com" name="ExternalQuestionIFrame"></iframe>
Also, I made sure I don't have any button named 'submit'. Any ideas of how I could debug this thing?
The issue here is usually that you're not submitting the appropriate information back to MTurk. You need to send the assignmentId parameter in addition to at least one other named field. I often just add a &foo=bar (or similar) to the end of the submit URL. So you should be submitting to something like:
https://workersandbox.mturk.com/mturk/externalSubmit?assignmentId=34J10VATJGBKANG4MDCHRA6ME53QIH&foo=bar
That's for the sandbox. For the live server, switch the base URL to https://www.mturk.com.
Amazon MT HITs seems to be printing a generic error message for a wide range of issues. This causes the problem to be particularity hard to debug.
For me, the error occurred since I was not assigning "name" attribute to my input elements in the form.
You must include the HTML name attribute in the input field definition. Make your name attributes descriptive because they are used as the column headings in the Results table.
If you are using the GUI to build and deploy your tasks, I recommend giving this document a good read and see if you have missed something.
MT Requestor UI guide
Hope this helps.

ADF Essentials in Glassfish: AUTOSUBMIT and VALUECHANGELISTENER attribute makes a message appear in the Web Browser

I have a ADF project in Jdeveloper 11.1.2.4.0, one of my pages contains this:
<af:selectOneChoice label="HEllO" value="#{bean.data}" id="id1" autoSubmit="true" valueChangeListener="#{bean.createNewData}">
<f:selectItems value="#{data.list}" id="id2"/>
</af:selectOneChoice>
I deployed it to Weblogic and everything worked fine.
Then I deployed it to Glassfish using the ADF Essential libraries. And it seems to work fine, but there is a unsuspected behavior at any place where there is a attribute AUTOSUBMIT. Everytime the value of the component containing the AUTOSUBMIT="true" is changed I have this behavior...
Firefox: A message saying: "To display this page, Firefox must send
information that will repeat any acction..."
IE: A message saying: "To display the webpage again, the web browser needs to resend the information you've previously submitted.."
Chrome: It redirects to the back page.
Opera: It redirects to the back page.
EDIT: The same happen when I have PARTIALSUBMIT set to true. I realized that I have to have the valueChangeListener attribute in order to get message.
Autosubmit=true will make (by default) your page to resubmit entirely. You should use partial triggers to avoid this. Set the ID of this component to the 'partial Triggers' attribute of the component you want to refresh (form,table, etc.). You should set 'partialSubmit=true' to your first component.

Dumping browser document content using Zombie.js

Using browser.visit, I am fetching the page of a browser as shown in the documentation. According to the browser API, browser.document returns the main window's document. However, I am not sure how to dump (display) the contents of the document. Is there a method like browser.document.toString() or browser.document.text() to be able to print the contents of the document in the console.
Thanks,
Sony
What you want is probably:
browser.document.innerHTML
There is a browser.text(selector, context?).
Selector is a CSS selector evaluated against the document body.
Context is a optional second argument, the CSS selector is evaluated against the element given as the context.
You can say something like browser.text('body') to get the text in the body.
I got here while looking for answer for the same question.
I may be late for the party, but try using
Browser.visit(url, function(error, browser){
fs.appendFileSync('index.html', browser.html());
})
Remember to put error checking here and do better handling, but should give you basic HTML document.
If it's not necessarily HTML (like you find yourself pulling XML or JSON through Zombie due to complicated, valid reasons...), you can access it like this:
browser.document._childNodes[0]._nodeValue