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

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/

Related

Microsoft Power Automate - error with flow - Action 'Parse_JSON' failed

I have an error with my flow - Action 'Parse_JSON' failed:
Details:
Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'.
Please see the screenshot above, it appears when a the file upload feature on the MS Form is not inputted, but as this question on the Form is optional we need this flow to work either when the file upload is present or not.
Many thanks,
Andy
Most likely your JSON is expection data in a field that got null. In the example her I fixed it by adding "null" as a valid value, so "emailadress2" is no longer mandatory.
See also https://powerusers.microsoft.com/t5/General-Power-Automate/Handling-NULL-in-Parse-JSON/td-p/40906

Etrade API response indicates missing "stopPrice" field/value when its in the request payload

Technical issue with etrade API.
I am constructing a trailing stop sell-to-close order with the following preview in Sandbox:
"{"PreviewOrderRequest":{"orderType":"OPTN","clientOrderId":"27099010699269ea2bee","Order":[{"allOrNone":"false","priceType":"TRAILING_STOP_CNST","orderTerm":"GOOD_FOR_DAY","marketSession":"REGULAR","trailPrice":".15","stopPrice":0,"Instrument":[{"Product":{"symbol":"MSFT","securityType":"OPTN","callPut":"CALL","expiryYear":"2021","expiryMonth":"9","expiryDay":"24","strikePrice":"290"},"orderAction":"SELL_CLOSE","orderedQuantity":"10","quantity":"10"}]}]}}"
However, in response, I am receiving the following error message:
"{"Error":{"code":7,"message":"You did not specify a stop price. Please fill in the missing information and resubmit your order."}}"
As you can see, I am setting the "stopPrice":0 in the order object. I put zero "0" since this is the value used in several examples from the documentation:
https://apisb.etrade.com/docs/api/order/api-order-v1.html#/definitions/OrderDetail
And I tried it as both a number and string: "stopPrice":"0" without success.
Is there a different field/value to set or format/configuration to make this work?
The obvious question is whether 0 is a valid value.
I'd be surprised if it is, but it's easy to check.

IBM Integration Toolkit Issue for Validation

I am working on IBM Integration toolkit. I wanted to understand the exact validation feature of a particular input node via an example. Can anyone help?
Validation on inputs node you can see them in validation tab, you can choose how to validate (content, conent and value or none if you like to implement your own vaildation and what to do if this validate is failure (Exception , Exception List , user trace, log local error),
validation done automatically depends on the message parser : [BLOB, XMLNSC, XMLNS, SOAP, MRM, ..etc ], and message structurewhich is defined in your message set.
for example :
If you create a message set with message definition file and this message definition has got and element and this element is required and integer, and you set this message set to your input node, validation feature runs automatically if you put for example string value or you left it empty validation exception occurs.

Codeigniter Form Validation - Is there a way to define multiple different %s when setting error messages?

Based on the documentation, %s will be replaced by field name when setting error messages.
If you include %s in your error string, it will be replaced with the
"human" name you used for your field when you set your rules.
Is there a way to have multiple %s in the string and define them differently?
This is the line in the form validation library that creates the error message:
// Build the error message
$message = sprintf($line, $this->_translate_fieldname($row['label']), $param);
$line: The error message template, for example "The % field is invalid"
$this->_translate_fieldname($row['label']): The field's label
$param: The parameter passed the the validation function, if any, max_length[5] would pass "5"
So that's the extent of what the form validation class does for you. If you need more flexibility you'll have to prepare the error message yourself <-- might be useful beforehand with the extra variables already populated.
It might be interesting to extend the form validation class via core/MY_form_validation.php and work this functionality in. Unfortunately this line is contained in the main function _execute which is very big and messy, and from looking at it now, you'd need to overload some other functions as well. I started to write an example but it actually looks like a chore. You might be better off using:
$this->form_validation->set_message('rule_name', 'Your custom message here');
More on setting error messages: http://ellislab.com/codeigniter/user_guide/libraries/form_validation.html#settingerrors

WebObjects field validation

I'm trying to find a good way to do field validation in a WebObjects app. If I have a text field and I tie a number formatter to it, it seems that the default behavior is to parse out the number IF the user enters in a valid number, or, if the user enters an invalid number, it seems to just ignore the value entered by the user. I can't do the validation in a save method or an action method because WO will have already ignored the non-number input by the time it reaches the action method. Is there a standard/recommended way, in a WebObjects app, of validating user input such that the user can be alerted of invalid input, rather than just ignoring the invalid input?
This page: http://en.wikibooks.org/wiki/WebObjects/EOF/Using_EOF/Validation claims that WO and EOF have "an incredible array of validation mechanisms" and even hints that there is a built-in way to prevent the user from entering inappropriate data, but I haven't been able to find any documentation or examples of how to do that (if there is, in fact, a built-in way). Coming up with a custom javascript validator to prevent inappropriate data seems like it would be a nightmare - finding a way to make the JS recognize and handle all of the same edge cases that the backend formatters/parsers handle. It would be nice if WO really did have a built-in way to propagate the formatter edge cases over to JS validation.
The above link also says there is a validationFailedWithException method in WOComponent that gets called "when an EO or formatter failed validation during an assignment", but how can I make a formatter fail validation in the non-number example case above? I've tried having the formatter throw an exception in the parse method if a non-number is entered, but that exception doesn't get passed to the validationFailedWithException method. Does anyone know how I can trigger an exception in a formatter that will trigger a call to validationFailedWithException()? And is that even the best/recommended way? Does anyone know of a better way?
I'm pretty sure, that validationFailedWithException is getting called for every formatting error. You should receive there an NSValidationException that wraps a ParseException. The method is usually called on the component containing the binding. It may get skipped on caret (^) bindings.
All the standard number formatter already throw a ParseException (see Format.parse(String)).
The validation handling in WebObjects can get quite complex, it really depends on your needs. But it was designed without JavaScript or Ajax in mind. Newer approaches in Wonder may incorporate the client side, but I have no experience with it.
The normal validation sequence is:
if needed convert the input into the target type with a formatter
call a validateAttributeName method on the target object, where AttributeName is the attribute name to receive the value
When something fails in this sequence validationFailedWithException is called.
While saving an enterprise object "validateFor..." is called on the objects. An exception at this point has to be caught in your action method.
So you have two points to handle validation errors. The "syntactical" errors have to be handled in validationFailedWithException. After this point you have valid inputs. You may manually further check those or greater object structures in your action method or in validateFor... (e.g. validateForSave).

Resources