SweetAlert printing error messages from array - sweetalert2

Can SweetAlert print error messages that are given to it from PHP via an array? If so, is there an example of this?
Specifically, can it read directly from a json_decode the actual error message to print?

Related

API reply with multiple card errors

Using the sandbox, if I generate multiple errors, like using 911 for the CVV and 01/40 for the date, and 99999 for the zip code, the reply has only one error in it. With all three of those error generating values, it returns only "Postal code check failed." Is there some way to get all errors back in a single post? What is the point of the JSON errors object being an array if only one error is included?

Dingo APi error message

I am trying to render my mailable in the browser in order to check the content. However I'm getting this message {"message":"sha1() expects parameter 1 to be string, object given","status_code":500}
My code snippet
I am running Dingo/Api on my page as well an I think it's somehow connected with it.
Can you please give me the suggestion why am I getting this message instead of rendering mailable?
Thank you
We got this to work by assigning the mailable to a var first and then directly calling the render function on it, like so:
$mailable = new YourMailableName();
return $mailable->render();

How to get messages as array instead of html block in magento

at my template
checkout/cart.phtml
There is one line
echo $this->getMessagesBlock()->getGroupedHtml();
Which returns html block of messages like errors
How can I get this messages as array instead of entire HTML Block ?
thanks
In magento, there are 4 types of messages.
Error
Warning
Notice
Success
You can use following method to get all messages as a collection of array.
$this->getMessagesBlock()->getMessages();
If you specify the type of message that you need to retrieve inside getMessages(), you will get only that type of messages as an array. ie
$this->getMessagesBlock()->getMessages('error');
$this->getMessagesBlock()->getMessages('warning');
$this->getMessagesBlock()->getMessages('notice');
$this->getMessagesBlock()->getMessages('success');

Is there a way to make angular run all the validations of an input instead of stoping when the first validation fails?

I'm having problems trying to make angular run all the validations of an input at once.
Here is a jsfiddle example of my problem http://jsfiddle.net/carpasse/GDDE2/
if you type 1 character on the email input you get this "The minimum lenght is 3." error message
and is not until you type 2 more characters than you get the other error message "This is not a valid email."
Does anybody know how to make angular show both error messages at the same time??
Thanks a lot in advance
You problem is not that all the validators are not being run - they are!
Remember that the way these validations work is by passing the view values through a pipeline of transformation functions, which can also specify the validity of the value.
The problem is that the min length validator passes undefined down the pipeline if it is not valid and that the email validator says that undefined is a valid email address!
Try creating your own validation directive that says that undefined is not a valid email address and you will find both errors are showing: http://jsfiddle.net/eKfj3/

If codeigniter model returns 0 rows, display custom error message. How to extend to a general case?

I have a variety of functions within my models which serve a different purpose.
One for example looks up the data for a given $_GET variable in the URL string.
I am trying to work out a way of displaying an error message if there is no matching row in the database due to url string manipulation for example.
My first idea was simply to return an error message (if there is an error) with each call to the function, then simply have an if statement whereby if there is an error, an error view is shown, and if not the normal view is shown..
Problem with this is that this function is called numerous times in my controller, and other similar functions are called throughout my code which need similar error handling..
I dont want millions of similar if/else statements all over my code to handle errors..
Anyone got any better ideas?
Cheers
Use the flashdata item of the session class. You can concatenate error messages and put them in the flashdata item to display.
my_function(){
// code that determines if there is an error returns => $error
if ($error)
{
// concat previous and current errors
$new_error = $this->session->flashdata('errors') . $error;
// replace 'errors' with newly concatenated errors
$this->session->set_flashdata('errors', $new_error);
}
}
This will keep track of all errors generated through each request and allow you to display a "list" of errors for that particular request.
echo $this->session->flashdata('errors');

Resources