angular custom directive required validation is not updated - validation

i created my own directive, replacing an input field with a custom made input field. However, the validation of the required field never seems to update and instead is always false.
Other directives inside my directive like ng-class do work.
I have created a plunker here to show this problem:
http://plnkr.co/edit/NuZNAJceL0MVX8i6RK9n?p=preview
Can anybody help me out how to make sure that the required validation is properly updated?

Related

Convert Sitecore 8 XHTML Validation from Error to Warning

I am wondering if anyone knows how to convert an convert a Sitecore Validator to display a warning instead of an error. Specifically the Full Page XHTML validation. Basically we want to keep the warning on the page as a CYA and not remove it completely but still allow content editors to proceed.
How would I accomplish this best if possible? Any pointers are welcome!
You can find the validation rules under /sitecore/system/Settings/Validation Rules.
In the example of Full Page XHTML validation, that would be /sitecore/system/Settings/Validation Rules/Item Rules/Item/Full Page XHtml. You can actually edit the Parameters field. To change the severity of the validation, add the Result parameter, with one of the following values:
Valid
Suggestion
Warning
Error
CriticalError
FatalError
In your example to have the error show as warning, set the Parameters field to Result=Warning
Note that this change will show everywhere the rule is used (and breached).

Change text of Please fill out this field tooltip in Joomla 3

It is set by default that when I create input fields and set them to be required, when users don't fill in anything, they got a massage:
Please fill out this field
I am creating a website with Joomla, and this tooltip pops out in every browser displaying the above text. How to change the text.
I tried to look up in Joomla language ini files, but no success. Is there some easy way to change this, or some advice where it could be?
This is not a Joomla string, it's the message displayed by the HTML5 required attribute. To change the message you have to check the loads of suggestions in the following questions:
HTML5 form required attribute. Set custom validation message?
How to change default “please fill out this field” in two field
if you are writing your own component (or module/plugin), it sounds like this is the description - field in the form-xml for your component. If the form is auto-generated from a component-creator, the file should be found in
/(administrator/)components/com_yourcomponent/models/forms
but some more info on where/what you are doing would help.
regards Jonas

Force numeric keyboard on Mobile and not break validation in Chrome

Here is my situation. I need to show a numeric keyboard on a mobile device. I know that to do that you need the attribute type="number" on the input tag.
I also am using a validator to check for various conditions. I have discovered that in Chrome ONLY, the validator will not fire if the type is set to "number". I have tried attempting to change the attribute with jQuery, and it will not change. I know my jQuery is correct, because if I change it from "type" to "type1" it adds the attribute.
With that said, I don't think it will make a difference, because if I inspect element, and manually change the type from "text" to "number" the validation breaks. Works fine in Firefox and IE, perhaps a bug in Chrome. It might have something to do with the fact that Chrome uses those handy up/down arrows, but those don't help me if validation is skipped. If anyone knows a workaround, I would love to hear it.
Additonal Info: Chrome is up to date. disableClientSideValidation is set to true, since I hate alerts and am using 'display-errors' to show error msgs right on the page. The edit box is bound to a field in a managed bean of data type "String". Also, I cannot add the attribute using the 'attrs', if I do so it is ignored. For more details on the validation see this blog post: http://notesspeak.blogspot.com/2013/08/the-benefits-of-using-validator-in.html
What's your code? I think that's going to help identify the cause.
If disableClientSideValidation is set to true, the browser shouldn't have any impact on validation. Server-side validation doesn't know or care about the browser type.
Custom validators do not run if the field is blank. If you need to force the field to be entered, you need to add a required validator as well.

How to add richtext (wysiwyg) field to a Magento widget

I created a few small widgets for magento. Everything fine, but I can`t seem to figure out how to add a richtext (tinymce wysiwyg) field to my widget.
Only thing I find on this is: "use ‘wysiwyg’ => true" in "$fieldset->addField". But I cannot use this in my custom widget, can I?
I understand that I can use addField to add a field to for example a product or CMS page.
But the only way of adding fields in my custom widget, as far as I know, is by adding parameters in my widget.xml. Other widget I build by following some tutorial returns a button, by using a custom type as parameter:
$removeButton = $this->getLayout()->createBlock('adminhtml/widget_button')
->setType('button')
->setClass('delete')
->setLabel($this->__('Remove Image'))
->setOnclick('document.getElementById(\''.$element->getId().'\').value=\'\';if(document.getElementById(\''.$element->getId().'_image\'))document.getElementById(\''.$element->getId().'_image\').parentNode.remove()')
->setDisabled($element->getReadonly())
->setStyle('margin-left:10px;margin-top:7px');
But i just can`t figure out how to add a richtext field in either my Widget.xml or my phpfile for the custom type.
What am I missing? Hope someone can help me out.
There are a few related entries here on stackoverflow, try searching if you are still having problem with this. Also, have a look at this brilliant article: http://www.behrendt.io/2013/04/12/using-a-wysiwyg-editor-in-a-magento-widget/
It helped me getting started. I got it working as a plain text field but whenever I turn the field to true WYSIWYG the content is never updated and the AJAX call does not contain the new HTML.

Validation strategies with AngularJS

I'm evaluating AngularJS and so far I'm very enthusiastic about it. But there's something missing on the validation front: the available options, such as the built-in mechanisms and the AngularUI initiative, implement validators through directives and, as such, every validation should be declared in the view:
<form ng-controller="SomeController">
<!-- Notice the 'required' attribute directive below: -->
<input type="text" ng-model="user.name" name="uName" required />
</form>
In this example, the view is defining that user.name is required. It's like saying the view defines the proper shape of the model. Isn't it a little backwards? Shouldn't the view reflect the states, including error states when it's the case?
Am I mistaken? I'm wondering if it's possible to apply any validators in the controller, signaling the model's data as valid/invalid, and updating the view accordingly (painting form controls with red, showing error messages, clearing previous errors and so on). I'm assuming AngularJS is powerful enough for this, but in the docs and samples so far I just haven't seen anything like I've described above. Thanks!
I guess its all about perspective. The way I see it is, you are defining a view which contains a form and that form contains an input of type text. It is this text input that you are marking as required. If you note, angular does not care if the text is user.name or user.age or whatever else. Its just associating that text input with required. So its just validating that text input and the model associated with that model is the final result ( the place where the value goes in if the validation passes! ).
Have a look at
http://docs.angularjs.org/guide/forms
for custom form validations, if you want to to be doing validations that are not the default ones.
Since you already know the view that is getting produced in advance ( lets call it at compile time! ) , you can associate all validators in the view and hence wouldnt have to do it in the controller (which perhaps is for run-time validation! ).

Resources