required-field

html5 required validator not working with input type=button

南楼画角 提交于 2019-11-29 10:22:36
Here is my html code <form id="form1" runat="server"> <input id="q" required /> <input id="btn" type="submit" value="Search"> </form> I have used html5 required field validators, it works but with a post back. so modified the code as follows to avoid postback <form id="form1" runat="server"> <input id="q" required /> <input id="btn" type="button" value="Search"> </form> But the required validator doesn't work That's because the required validator is only called on submit, and the type=button is not a submit. Try this ( http://jsfiddle.net/upgradellc/vrTLw/ ): <form id="form1" runat="server">

HTML required readonly input in form

空扰寡人 提交于 2019-11-28 18:37:41
I'm making a form. And on one input tag is an OnClick event handler, which is opening a popup, where you can choose some stuff, and then it autofills the input tag. That input tag is also readonly , so only right data will be entered. This is the code of the input tag: <input type="text" name="formAfterRederict" id="formAfterRederict" size="50" required readonly="readonly" OnClick="choose_le_page();" /> But the required attribute isn't working in Chrome. But the field is required. Does anybody know how I can make it work? I had same requirement as yours and I figured out an easy way to do this

ExtJS 4 - Mark a red asterisk on an required field

落花浮王杯 提交于 2019-11-28 05:23:54
I have this problem where I need to add a red asterisk beside a fieldLabel when a field is marked as "required" (or allowBlank: false ) In ExtJS3, we can have this hack easily by overriding Ext.layout.FormLayout as follow: Ext.override(Ext.layout.FormLayout, { getTemplateArgs: function(field) { var noLabelSep = !field.fieldLabel || field.hideLabel; var labelSep = (typeof field.labelSeparator == 'undefined' ? this.labelSeparator : field.labelSeparator); if (!field.allowBlank) labelSep += '<span style="color: rgb(255, 0, 0); padding-left: 2px;">*</span>'; return { id: field.id, label: field

checking each required input for empty value with jQuery

送分小仙女□ 提交于 2019-11-28 04:25:20
问题 I am checking for each required fields in a form. I tried this but it only works for the first input. How can I make it work for each input? if($('[required]').val() != ''){ $('.button1').fadeIn(0); $('.button2').fadeOut(0); }else{ $('.button1').fadeOut(0); $('.button2').fadeIn(0); } EDIT : for more context, here's another function I had below this to apply whenever they change and HTML code. $('[required]').change(function() { if($('[required]').val() != ''){ $('.button1').fadeIn(0); $('

HTML required readonly input in form

你。 提交于 2019-11-27 11:31:32
问题 I'm making a form. And on one input tag is an OnClick event handler, which is opening a popup, where you can choose some stuff, and then it autofills the input tag. That input tag is also readonly , so only right data will be entered. This is the code of the input tag: <input type="text" name="formAfterRederict" id="formAfterRederict" size="50" required readonly="readonly" OnClick="choose_le_page();" /> But the required attribute isn't working in Chrome. But the field is required. Does

Why does <h:inputText required=“true”> allow blank spaces?

天大地大妈咪最大 提交于 2019-11-27 08:54:18
When I set required="true" in a <h:inputText> , it still allows blank spaces. I have been trying to modify the jsf-api.jar but I could not understand how to generate new a JAR, so I tried to modify the isEmpty() method from UIInput class and compile it, open the jsf-api.jar and replace it with the new one, but it did not work. What I need is to do trim() when the user writes in a <h:inputText> to do not allow blank spaces. How can I achieve this? If you want to download the jsf-api.jar resource, you can do it, just read how to at: http://javaserverfaces.java.net/checkout.html . That's normal

ExtJS 4 - Mark a red asterisk on an required field

本秂侑毒 提交于 2019-11-27 00:59:41
问题 I have this problem where I need to add a red asterisk beside a fieldLabel when a field is marked as "required" (or allowBlank: false ) In ExtJS3, we can have this hack easily by overriding Ext.layout.FormLayout as follow: Ext.override(Ext.layout.FormLayout, { getTemplateArgs: function(field) { var noLabelSep = !field.fieldLabel || field.hideLabel; var labelSep = (typeof field.labelSeparator == 'undefined' ? this.labelSeparator : field.labelSeparator); if (!field.allowBlank) labelSep += '

Why does <h:inputText required=“true”> allow blank spaces?

a 夏天 提交于 2019-11-26 17:47:31
问题 When I set required="true" in a <h:inputText> , it still allows blank spaces. I have been trying to modify the jsf-api.jar but I could not understand how to generate new a JAR, so I tried to modify the isEmpty() method from UIInput class and compile it, open the jsf-api.jar and replace it with the new one, but it did not work. What I need is to do trim() when the user writes in a <h:inputText> to do not allow blank spaces. How can I achieve this? If you want to download the jsf-api.jar