required

Safari is not acknowledging the “required” attribute. How to fix it?

梦想的初衷 提交于 2019-11-27 17:35:06
问题 <form id="customerForm"> <label> First Name: <input id="firstName" required /> </label> <label> Social Security Number: <input id="ssn" required pattern="^d{3}-d{2}-d{4}$" title="Expected pattern is ###-##-####" /> </label> <input type="submit" /> </form> When I try that document in Chrome, it accepts the conditions and shows the error, as expected. But when I try that document in Safari, it shows no error. 回答1: At this time, Safari doesn't support the "required" input attribute. http:/

HTML5 required attribute seems not working

99封情书 提交于 2019-11-27 15:45:43
问题 I can't figure out why the new required attribute of HTML5 seems to not be working, and I know my simple code seems to be okay. What should I do to make this work? Here is my code in HTML: <input type = "text" class = "txtPost" placeholder = "Post a question?" required> <button class = "btnPost btnBlue">Post</button> Correct me if I'm wrong but, if ever I run the code in the browser and click the button without any value in the textbox it should have a tooltip showing that that field was

HTML5 Required input styling

半世苍凉 提交于 2019-11-27 14:37:28
In HTML 5, we can mark inputs as required and then select them with the [required] pseudo-selector in CSS. But I only want to style them when they try to submit the form without filling out a required element. Is there a selector for this? How about for the little message box which pops up? Yeah as SLaks said there is no CSS selector to do this. I would doubt this will ever be in the scope of CSS because CSS would need to check the contents of an input. Your best option, still, is probably to call a javascript validation function when clicking a button, rather than actually submitting the form

Required and Optional Arguments Using Boost Library Program Options

拈花ヽ惹草 提交于 2019-11-27 09:34:31
问题 I'm using Boost Program Options Library to parse the command line arguments. I have the following requirements: Once "help" is provided, all the other options are optional; Once "help" is not provided, all the other options are required. How I can deal with this? Here is the my code handling this, and I found it's very redundant, and I think there must be an easy to do, right? #include <boost/program_options.hpp> #include <iostream> #include <sstream> namespace po = boost::program_options;

How can a required reboot be detected for Windows 7

徘徊边缘 提交于 2019-11-27 03:24:42
问题 I am working on a project where several software and drivers are installed on a windows 7 PC. This shall work without user inputs. Now there is the question: How can I determine in this program if a reboot is required to finish an installation (can be driver or software). We are working on Windows 7 embedded and there is no taskbar enabled or any tooltips or something like this visible. Software is installed in silent mode. 回答1: Use the following registry key: HKLM\System\CurrentControlSet

Enforce not-null field in JSON object

╄→尐↘猪︶ㄣ 提交于 2019-11-27 03:04:58
问题 Our REST API receives some JSON objects input where some fields are required to be not null. Those can be either String/Integer or even might be some other class instance as reference. We are trying to find a way to enforce those field to be not null, instead of the correct way for null check in the API. Current: if (myObject.getSomeOtherObject() == null) throw new SomeException(); What we want to have is something like: class MyObject{ @Required OtherObject someOtherObject; // ... } We have

Is the 'as' keyword required in Oracle to define an alias?

*爱你&永不变心* 提交于 2019-11-27 02:29:04
问题 Is the 'AS' keyword required in Oracle to define an alias name for a column in a SELECT statement? I noticed that SELECT column_name AS "alias" is the same as SELECT column_name "alias" I am wondering what the consequences are of defining a column alias in the latter way. 回答1: According to the select_list Oracle select documentation the AS is optional. As a personal note I think it is easier to read with the AS 回答2: (Tested on Oracle 11g ) About AS : When used on result column , AS is

Conditionally required property using data annotations

余生长醉 提交于 2019-11-27 00:10:14
问题 I have a class like this: public class Document { public int DocumentType{get;set;} [Required] public string Name{get;set;} [Required] public string Name2{get;set;} } Now if I put a [Required] data annotation on the Name and Name2 properties, then everything is ok and if Name or Name2 are empty, validation will throw an error. But I want Name field only to be required if DocumentType is equal to 1 and Name2 only required if DocumentType is equal to 2 . public class Document { public int

html5 required attribute on non supported browsers

时光怂恿深爱的人放手 提交于 2019-11-26 23:30:39
问题 I have a web application which makes use of the HTML5 required attribute frequently. However Safari and ie 8/9 do not support this attribute. Is there a jQuery plugin that will force the behaviour on non-compatible browsers? 回答1: This works without any plugin (JQuery only): <script> // fix for IE < 11 if ($("<input />").prop("required") === undefined) { $(document).on("submit", function(e) { $(this) .find("input, select, textarea") .filter("[required]") .filter(function() { return this.value

What is the difference between required and ng-required?

老子叫甜甜 提交于 2019-11-26 23:29:11
What is the difference between required and ng-required (form validation)? Tiago Roldão AngularJS form elements look for the required attribute to perform validation functions. ng-required allows you to set the required attribute depending on a boolean test (for instance, only require field B - say, a student number - if the field A has a certain value - if you selected "student" as a choice ) As an example, <input required> and <input ng-required="true"> are essentially the same thing If you are wondering why this is this way, (and not just make <input required="true"> or <input required=