required

HTML5 required attribute seems not working

两盒软妹~` 提交于 2019-11-29 01:13:55
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 required, shouldn't it? But nothing happens no matter how many times you click the button. Am I

Angular is automatically adding 'ng-invalid' class on 'required' fields

我是研究僧i 提交于 2019-11-28 20:54:27
问题 I am building an angular app for which I have some forms set up. I have some fields that are required to be filled before submission. Therefore I have added 'required' on them: <input type="text" class="form-control" placeholder="Test" ng-model="data.test" required> However when I launch my app, the fields are displayed as 'invalid' and the classes 'ng-invalid' and 'ng-invalid-required' even before the submit button has been click or before the user has typed anything in the fields. How can I

Conditionally required property using data annotations

血红的双手。 提交于 2019-11-28 16:38:53
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 DocumentType{get;set;} [Required(Expression<Func<object, bool>>)] public string Name{get;set;} [Required

Required and Optional Arguments Using Boost Library Program Options

。_饼干妹妹 提交于 2019-11-28 16:09:29
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; bool process_command_line(int argc, char** argv, std::string& host, std::string& port, std::string&

Dojo validation of a textarea

筅森魡賤 提交于 2019-11-28 12:22:20
I'm attempting to use dojo for the first time, so this may be be obvious. I have a very simple form with one textarea in it that needs to be filled in. <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.10.3/dojo/dojo.js"></script> <form id='form1' action="" method="" dojoType="dijit.form.Form"> <label for="dob">desc:</label> <textarea class='multilinecontrol' dojoType="dijit.form.Textarea" selected='true' required='true'></textarea> <button type='submit' id="next" name="next" dojoType="dijit.form.Button"> Next</button> </form> I've added the 'required' property, so i can ensure the form

Enforce not-null field in JSON object

一世执手 提交于 2019-11-28 09:41:52
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 tried 3 things: 1) Upgrade to jackson 2.0.6 and use annotation com.fasterxml.jackson.annotation

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

你离开我真会死。 提交于 2019-11-28 08:51:59
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. 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 (Tested on Oracle 11g ) About AS : When used on result column , AS is optional. When used on table name , AS shouldn't be added, otherwise it's an error. About double quote : It's optional &

How does @Required annotation work with JavaConfig?

佐手、 提交于 2019-11-28 07:25:19
问题 I'm pretty new to the Spring Framework and I got problems to understand the @Required annotation in combination with a Java configured application. Here is an example. Config-File @Configuration public class AppConfig { @Bean public Movie movieA() { return new Movie(); } @Bean public MovieHolder holder() { return new MovieHolder(); } } MovieHolder.java public class MovieHolder { private Movie movie; public Movie getMovie() { return movie; } @Required public void setMovie(Movie movie) { this

Conditionally make inputs required depending on checkbox value

做~自己de王妃 提交于 2019-11-28 06:02:32
问题 On my JSF page, I have a HTML input checkbox where allows users to choose if they want the gift or not, and the <div> section under the checkbox information will only be displayed if the checkbox is checked. Once the checkbox is checked, users will be required to select an option (from a dropdown menu, initial value of dropdown menu = null); however, the selection is not required if the checkbox is not checked. So, here comes two conditions: A. Checkbox is checked ( == div view is played)

Firefox 4 : Is there a way to remove the red border in a required form input?

对着背影说爱祢 提交于 2019-11-27 18:39:19
When required is defined in a form field, Firefox 4 automatically shows a red border to this element, even BEFORE the user hits the submit button. <input type="text" name="example" value="This is an example" required /> I think this is disturbing for the user as he/she asn't made mistakes at the beginning. I wnat to hide that red border for the initial state, but show it when the user hits the send button if there is a missing field marked as required. I looked at :required and :invalid from new pseudo selector, but the changes are for before AND after the validation. (from Firefox 4 Required