required

Require fieldset after checkbox checked

断了今生、忘了曾经 提交于 2019-12-06 10:44:52
I just started learning HTML/CSS, javascript and jQuery last week and would very much appreciate some help. I have created a form with a checkbox (id #ship_to_billing) and then a fieldset (id #shipping_info) containing 5 text fields. Using JQuery I've set it up so that, if that if the checkbox is checked, it toggles the other fields and hides them. But, I cannot figure out how to additionally require one or the other, either the checkbox has to be checked or all of the text fields within the fieldset must be completed. I do not need an alert. Please help! Thank you all in advance, Susan <a

How to change html5 pattern error messages for email

情到浓时终转凉″ 提交于 2019-12-06 02:44:14
Html5 required attribute adds normally the error message "Please fill out this field." and it can easily be changed with the following code oninvalid="setCustomValidity('Custom text in another language..')" oninput="setCustomValidity('')" However, I have noticed that when I use inputs with type email I still get messages such as "Please enter a part following '@." and "Please include an '@' in the email address", how can I change them? The custom error message comes from the element's title, or by using setCustomValidity , as you said. But message like "Please include an '@' in the email

Flutter: @required keyword

做~自己de王妃 提交于 2019-12-06 00:04:26
I don't really understand how @required works. For example I've seen this code: class Test{ final String x; Test({ @required this.x }); factory Test.initial(){ return Test(x: ""); } } But what should @required do here? Seems like it makes an optional parameter a non optional parameter. @required is needed when you have more than 1 named parameters and you want some of the parameters to be mandatory, you annotate it using @required . Example class Test { final String a; // say a is mandatory final String b; final String c; final String d; Test({ @required this.a, // annotate it using required

“alt” attribute on images and “title” attribute on links required in HTML5?

独自空忆成欢 提交于 2019-12-05 17:36:50
Me and other developers at our company are struggling with "title" and "alt" attributes. In the past, we added "title"-Tags to all links for SEO purposes (although some of them were annoing talking about usability) and "alt"-Tags on every image on the site, because HTML4 spec said so. Are "title" and "alt"-Tags still required ? If they're not required, do they still have effects on SEO? unor Check the HTML specification to see what is/isn’t required: a element : The ( global ) title attribute is not required. img element : The alt attribute is required in most cases ( exceptions ). (Questions

How to disable the required tag on a selectOneMenu when p:ajax event=change?

ε祈祈猫儿з 提交于 2019-12-05 13:47:55
Here is my configuration: PrimeFaces: 4.0.4 (elite) OmniFaces: 1.6.3 JSF: MyFaces 2.0.2 Server: WebSphere 8.5.0.2 Some code (I only post the relevant part for better clarity): <p:selectOneMenu value="#{viewModel.selectedContact}" required="true" converter="omnifaces.SelectItemsConverter"> <p:ajax event="change" listener="#{viewModel.updateContact}" update="area"/> <f:selectItem itemValue="#{null}" itemLabel="#{msg.no_contact}" noSelectionOption="true" /> <f:selectItems value="#{viewModel.contacts}"/> </p:selectOneMenu> So here, we have a simple p:selectOneMenu that contains a list of Contact

Jquery Validate: How To Ignore Placeholder Text (Produce Error on Default/Blank)

丶灬走出姿态 提交于 2019-12-05 05:53:41
问题 I'd like to make jquery validate ignore the default text. The way I have it check for default text is to check if the element.value == the elements alt text Here's my code, but it returns invalid no matter if its blank, default text, or any other text: $.validator.addMethod("notDefaultText", function(value) { if($(this).val()==$(this).attr('alt')) return false; }); rules: { Name: "required notDefaultText", Email: "required notDefaultText email" }, 回答1: I had the same problem and solved it

at least one field is required in angular 4 forms

不羁岁月 提交于 2019-12-05 02:38:21
问题 I'm using angular 4 forms and I have some fields. and first_name, last_name and company are really important for me. I want to force the user to fill one of these 3 fields. how can I do it? here are .ts codes: this.contactForm = this.fb.group({ first_name: [null, Validators.compose([Validators.required])], last_name: [null, Validators.compose([Validators.required])], email: [null, Validators.compose([this.validateEmail])], company: [null], position: [null], }); an html: <form [formGroup]=

Form with tinyMCE textarea having html5 required attribute cannot submit

筅森魡賤 提交于 2019-12-05 02:36:10
This is not a question, but an answer which I want to share with you. I've just spent over four hours tearing my hair out on something which turns out to be a bug in either TinyMCE or Firefox. With TinyMCE loaded, if you specify the HTML5 required attribute on a textarea the form will just not submit in Firefox. No errors, nothing in Firebug, just a stubborn refusal to submit. I don't know if this is a FF or a TinyMCE bug and don't really care. I just don't want other coders to go through the aggravation I've gone through these last hours. To ask a question: Is this bug documented anywhere?

Mongoose schema to require array that can be empty

血红的双手。 提交于 2019-12-05 02:21:38
I have this schema var StuffSchema = new mongoose.Schema({ _id: { type: String, required: true, unique: true }, name: { type: String, required: true } }); mongoose.model('Stuff', StuffSchema); Works fine. Now I need to add another schema "Cargo" containing this mystuff: { type:[String], ref: 'Stuff', required:true}, that is, I want mystuff to contain array of ids of Stuff, but this fails with validation error when running this code mongoose.model('Cargo').create( some data...) if I use an empty array for the mystuff field. It seems to work if I change the Cargo schema to mystuff: { type:

kendo ui, angular require validation for numeric text box

倾然丶 夕夏残阳落幕 提交于 2019-12-04 17:12:38
I am trying to use a kendo numeric text box with angular validation (ng-required) however I'm not able to get it working. The ng-required attribute on this element has no effect on the form validation status. From my understanding, the reason why this doesn't work is because kendo numeric text box uses k-ng-model to store it's value, whereas the angular validation works only with ng-model. Has anyone else seen this issue, are there any workarounds? I have found a workaround that involves using the kendo-numeric-text-box along with a hidden input field which makes use of ng-model. <input data