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.
Related
I am trying to mask/unmask a dojo text field upon clicking a mask/unmask-link..
On clicking this link I am changing the type property of the dojo-text field to "password" and vice versa..
but this is not working in IE8,9,10 versions.. works in IE11/Firefox though..
when searching google the advice was to recreate the same field with the existing properties and events with the needed type..
I can recreate the field, but I am just wondering how to get all the existing-events(dojo) of the current field.
Can somebody help me ?
I am also looking for any other approach other than this to handle this mask/unmask use-case, but considering using Dojo.
I'm using Dojo 1.4.
In older versions of Internet Explorer the type attribute of an input field is considered readonly (IE6, IE7, IE8, IE9?) and the browser will not let you change it. (This may also be the case if not running in Standards Mode - though I haven't tested this)
To overcome this you may need to remove it from the DOM, and create a new input of the type you want, and re-insert it.
I have a form that normally works with respect to dirtyforms. However, there is one circumstance where a jquery-ui datapicker calendar will pop up the "are your sure" dialog when a date is clicked.
I emphasize that this normally works correctly. The situation is related to the initial conditions of the form data source. Things work when the object being referenced is existing, but not if it is new. So I am sure somewhere there is a difference in the initial conditions of the form. But in theory the form should be identical.
How can I find what is causing the popup so I can fix my issue?
Well, I did find what was causing my problem by comparing the HTML of the working and non-working situations. (Not an easy task since there were many non-relevant differences.)
Seems that the original coder did a strange thing. Left out some Javascript function declarations when the page was "new" but of course did not eliminate the calls on those functions.
So I guess that the javascript errors were the root cause. At least when I include those function declarations everything works correctly.
By default, most anchor links on the page will trigger the dialog. We don't have a hard-coded selector of all potential 3rd party widgets, you must manually take inventory of whether these widgets use hyperlinks and ignore them if they are causing errant behavior.
See ignoring things for more information.
I was unable to reproduce this behavior using Dirty Forms 2.0.0, jQuery UI 1.11.3, and jQuery 1.11.3. However, in previous versions of Dirty Forms, you can probably use the following code to ignore the hyperlink clicks from the DatePicker.
$('.ui-datepicker a').addClass($.DirtyForms.ignoreClass);
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
The newer versions of Firefox have a new 'feature' that remembers the stuff that was filled out in a form and repopulates the form with these values on refresh (maybe in other situations as well?).
The problem is we have a quite complicated web application which uses a fair bit of ajax and hidden form fields which are never filled out by the user, but by javascript.
Because of this new 'Feature' we get a lot of errors when refreshing form because these fields are suddenly populated with invalid values.
So i'm looking for a way to turn this 'feature' off without disabling auto-completion. (because that IS useful on the fields our customers fill in)
if i put
autocomplete='off'
in my html, the effect is disabled, but this loses auto-completion (obviously).
the problem is in fields getting filled in after a refresh without any user action.
While the password manager will populate a username and password if there is exactly one match, autocomplete itself doesn't automatically populate fields. But I'm guessing you're thinking about the sort of refresh you get, say, if you reload the page. In this case the field values are restored by session history, but you might be able to turn that off by marking your page as uncacheable.
Well you should set the value of these fields to nothing or or whatever default value they have using javascript right before you start your other javascript/ajax tasks.
It is a browser feature - without going into the settings of each client browser you can't disable this.
I suggest more robust validation - client and server side.
After the page is loaded, but before you do any other logic, you should force the value to be empty:
inputElem.value = '';
Here is a jQuery solution I put together.
It doesn't disable the autofill, rather it overrides the fields after the browser has done it's thing.
I was trying to fight Chromes autofill when I made this. Just using .val('') on it's own didn't work since it triggered before chromes autofill functionality kicked it.
var noFiller = $('input[type="text"]');
noFiller.val(' ');
var t=setTimeout(function(){
noFiller.val('');
},60);//keep increasing this number until it works
The Javascript solution (setting field values to empty when the page loads or updates via Ajax) has already been mentioned.
Another option might be to generate the ids of your fields with random numbers attached to them so that the browser can't match them to cached values, but this may screw up other things.
Autocomplete isn't a new thing. Every browser has it. See this http://www.w3.org/Submission/web-forms2/#the-autocomplete
Autofill? Are you sure? Check your input's value attribute with Firebug (Firefox addon). Check you post and response in your ajax. Maybe your ajax is filling it behind scenes.
BTW: remenber to disable any external toolbar. There are some toolbars for Firefox/IE/Chrome/etc that autofill data for the user. Warning with this.
I was wondering if anyone knew if it were possible to override the default behaviour of browsers that support the new HTML input types such as type="email" and type="date"?
I appreciate that I could test if a browser supports an input type and provide a fallback for those browsers that don't, but what I want to know is is there any way to prevent that default behaviour from happening in browsers that do support it?
For instance, if in Opera I want to use the date input type, but I don't want Opera to display the native datepicker (i.e. I want to replace it with my own custom one) is that possible? Are there any DOM events triggered like onDatePickerShow that one can hook into?
I don't believe that this is possible, but if anyone knows for sure one way or the other I would love to hear from you.
input type=date without datepicker is almost the same as input type=text. If you want to keep validation, then you might use pattern attribute instead.
There's no way to customize look'n'feel of the standard date picker. There are no events for the picker. Spec doesn't define any UI for pickers. Consider how wildly different pickers can be – compare one you get on desktop with picker on the iPhone.
In the future CSS might get pseudo-classes for some customizations of date picker (and file picker), but currently it's all-or-nothing.
Disable validation of HTML5 form elements
If you add a novalidate attribute, then for example you can enter an email without an #
This only seems to disable the client side HTML5 validation.