How can I change the layout of an error in Joomla? - joomla

I am throwing an exception in a controller like this
throw new Exception("Could not save user. Error: " . $user->getError());
But the layout of the html that displays the message is not relevant with the layout of my website. So I need to put my hands and change the html of that layout.
How?

You really should catch the exception and then convert it to a message using setMessage if you need to tell the user something, otherwise log it and move on.
Also note that getError and setError are both deprecated.

Read this: http://docs.joomla.org/Custom_error_pages
This is: Put an error.php into /templates/your_template/error.php and style it to your wishes.

Related

Xamarin.Forms Accessibilty VoiceReader

Quick question.
When it comes to Xamarin Forms, I noticed that if there is an alert called from the ViewModel
e.g:
DisplayAlertAsync("Title","Message", "Ok");
That the voice assistant only auto reads the first parameter of DisplayAlertAsync ("title") and does not auto-advance to the following parameters.
So, a temporary solution I did was concatenate the 1st and 2nd parameters into the 2nd parameter, so that VoiceReader auto reads both the title and message for accessibility users.
e.g:
DisplayAlertAsync("" ,"Title"+ "\n"+ Message", "Ok");
Is there a way to keep the traditional DisplayAlertAsync("Title","Message", "Ok"); parameter assignment, and have VoiceReader auto advance to the following parameters?
What you are looking at is expected behavior. Since Xamarin Forms uses Native APIs, so the alert dialog in the native platforms also does the same thing- Whenever you open a new page/alert, it should read the Title of that view.
For the most part, what you want to keep an eye out for is images & icons, you have to override the description of those items.
Q. Is there a way to keep the traditional DisplayAlertAsync("Title","Message", "Ok"); parameter assignment, and have VoiceOver/TalkBack auto advance to the following parameters?
A. No there isn't, you would have to create your own custom renderer if you want the reader to read everything.

Wicket replacing panel with ajax fails with MarkupNotFoundException

the page markup has
<div wicket:id="stepPanel" />
tag in it and when the page is first loaded it works great that is
add(new MyFirstPanel("stepPanel"));
works fine. But then when I trigger an Ajax event and request redrawing
addOrReplace(new MySecondPanel("stepPanel"));
target.add(MyPage.this);
i get the following error
Last cause: Failed to find markup file associated. MyFirstPanel: [MyFirstPanel [Component id = stepPanel]]
please note that it tries to find the wrong markup (should look for markup for MySecondPanel) and it fails regardless it succedded to do so before!
I instantiate panels using reflection, but could it be a problem here? No exceptions thrown.
Anwser:
Actually it was something else - I have noticed that one of my AjaxSubmitLinks had reference to a form that was no longer placed in a markup... so whatever you do just remember not to leave that reference.
You are adding MyPage after replacing the Panel causing MyPage to re-render.
There is a good example on how to replace panels here.
Yes you can call panels via reflection. I don't clearly know what you are trying to do with event here but if you want you can attach your panel with AjaxSelfUpdatingTimerBehavior and define the duration which will update this component in the given time period.
Hope its useful.

Stripes Layout with Validation

I try to use the Stripes layout tags (layout-definition, layout-render, ...).
My layout include a header with a menu and a content under.
I render a form with Stripes validation in the content :
#ValidateNestedProperties({
#Validate(field="email", required=true, on="edit", converter=EmailTypeConverter.class), ...
If I use the validation I get an exception :
javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20
If I remove the validation of the form, it works...
Any idea how to be able to use both? Or probably I am doing something wrong?
Thanks!
Please post additional code for your layout. I do not believe this error has anything to do with your validation.
It could sound like you are calling jsp includes over and over again. e.g.:
a.jsp includes b.jsp which includes a.jsp etc...

How do I display command errors using Grails RemoteFunction Template rendering?

I have a template that renders a list of things.
I have a submitToRemote Button on this template that then pops up another template overlayed.
inside template2:
Now I have it working nicely. If the template2 submits correctly, the action renders template1 and all is well.
The problem is what happens if when submitting template2, the command object has an error. I believe I want to get the action to generate a failure, so that the failure:'groupSpecialtyCreateDiv' updates the groupSpecialtyCreateDiv instead of the groupSpecialtyList div.
Otherwise I am misunderstanding the purpose of the failure update parameter, so is there anyway to correctly handle command errors in this case?
I found the answer eventually. To trigger the 'failure' condition you need to throw an error status in the controller action;
response.status = 409 // conflict

Display a success message to user in a SharePoint Document Library after validation in ItemAdding Event

When validating a document in the ItemAdding event there are many ways to display errors to the user, but there doesn't seem to be a way to display successes to user, like a validation was successful. An info message to the user at the top of document library would be great.
public class MyItemEventReceiver : SPItemEventReceiver {
public MyItemEventReceiver() {}
public override void ItemAdding(SPItemEventProperties properties) {
// Do some validation
// If successful display message to user - can't seem to do
// If unsuccessful cancel and go to the error page - easy
}
}
}
In the event handler you have a Property called Cancel when set to true it will redirect you to the Error Page. Whereas when you dont distrub it, it will redirect you to the Metadata page of the document, i.e it will as you for the Name and Title of the document. Being said that out of the Box it is not possible to archive what you want to do. One alternate approach I would suggest is that once the validation is successful, set a Flag in the Session / Property Bag of the List with the Document GUID as the Key and in the Final Landing page deploy a Custom Web Part that will check for the this GUID and if there is a Value then It will display the Message.
Umm... edit List's AllItems.aspx or edit your masterpage, add Literal control to it. At ItemAdded event just refer to that control and set it's value.
Maybe it turns out you even need code-behind for that masterpage. Refer here.

Resources