validating

Rails validating full_name

江枫思渺然 提交于 2019-12-03 07:38:25
问题 Hey... how would you validate a full_name field (name surname). 回答1: Consider names like: Ms. Jan Levinson-Gould Dr. Martin Luther King, Jr. Brett d'Arras-d'Haudracey Brüno Instead of validating the characters that are there, you might just want to ensure some set of characters is not present. For example: class User < ActiveRecord::Base validates_format_of :full_name, :with => /\A[^0-9`!@#\$%\^&*+_=]+\z/ # add any other characters you'd like to disallow inside the [ brackets ] #

Rails validating full_name

烈酒焚心 提交于 2019-12-02 21:05:50
Hey... how would you validate a full_name field (name surname). Consider names like: Ms. Jan Levinson-Gould Dr. Martin Luther King, Jr. Brett d'Arras-d'Haudracey Brüno Instead of validating the characters that are there, you might just want to ensure some set of characters is not present. For example: class User < ActiveRecord::Base validates_format_of :full_name, :with => /\A[^0-9`!@#\$%\^&*+_=]+\z/ # add any other characters you'd like to disallow inside the [ brackets ] # metacharacters [, \, ^, $, ., |, ?, *, +, (, and ) need to be escaped with a \ end Tests Ms. Jan Levinson-Gould # pass

Why is moment.js allowing date with one digit year when using strict parsing?

女生的网名这么多〃 提交于 2019-12-01 23:42:05
I am using moment.js to parse a date. http://momentjs.com/docs/#/parsing/string-format/ This is to validate and convert the date to a format required by my database. In my testing I encountered this input date '6-4-3' which should not be valid with the given format. moment('6-4-3','YYYY-MM-DD',true).isValid(); //returns true The resulting date in the moment object is "Mon Apr 03 0006 ...". When I call isValid, it returns true. I think it should consider this date invalid because it has too few digits in the input for each part of the format string. I added a regex.test in my code to ensure

DataGridView Validation & Changing Cell Value

为君一笑 提交于 2019-11-30 06:31:12
问题 I would like to manipulate a cell in my DataGridView when it is validating so that if the user enters a value that is not valid for the database, but is easily converted to valid data, the program will change the value to an appropriate one. I am able to validate my value properly but when I try to change it to something valid I get a DataError. Here is my code: private void unit_List_2_GroupsDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { Console.WriteLine

DataGridView Validation & Changing Cell Value

时间秒杀一切 提交于 2019-11-28 19:19:22
I would like to manipulate a cell in my DataGridView when it is validating so that if the user enters a value that is not valid for the database, but is easily converted to valid data, the program will change the value to an appropriate one. I am able to validate my value properly but when I try to change it to something valid I get a DataError. Here is my code: private void unit_List_2_GroupsDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { Console.WriteLine("Validating"); DataGridViewColumn col = this.unit_List_2_GroupsDataGridView.Columns[e.ColumnIndex];

How to skip Validating after clicking on a Form's Cancel button

南笙酒味 提交于 2019-11-28 05:15:14
I use C#. I have a Windows Form with an edit box and a Cancel button. The edit box has code in validating event. The code is executed every time the edit box loses focus. When I click on the Cancel button I just want to close the form. I don't want any validation for the edit box to be executed. How can this be accomplished? Here is an important detail: if the validation fails, then e.Cancel = true; prevents from leaving the control. But when a user clicks Cancel button, then the form should be closed no matter what. how can this be implemented? If the validation occurs when the edit box loses

No identities are available for signing Xcode 5

走远了吗. 提交于 2019-11-27 17:21:43
I have an error "No identities are available for signing" when try to validate my app in Xcode 5. I tried all: Recreate certificates and provisioning profiles, all methods which have been described on this site and another resources; I'm confused, because when I try to distribute my app as Ad-hoc, it successfully create and install on test device an IPA file. But when I try validate my app or submit to AppStore, all the time I have an error. Maybe someone can help me with this issue. All you need to do is: go to Certificates, Identifiers & Profiles in the Developer Center create a new

No identities are available for signing Xcode 5

≡放荡痞女 提交于 2019-11-27 04:11:44
问题 I have an error "No identities are available for signing" when try to validate my app in Xcode 5. I tried all: Recreate certificates and provisioning profiles, all methods which have been described on this site and another resources; I'm confused, because when I try to distribute my app as Ad-hoc, it successfully create and install on test device an IPA file. But when I try validate my app or submit to AppStore, all the time I have an error. Maybe someone can help me with this issue. 回答1: All

How to skip Validating after clicking on a Form's Cancel button

孤者浪人 提交于 2019-11-27 00:51:13
问题 I use C#. I have a Windows Form with an edit box and a Cancel button. The edit box has code in validating event. The code is executed every time the edit box loses focus. When I click on the Cancel button I just want to close the form. I don't want any validation for the edit box to be executed. How can this be accomplished? Here is an important detail: if the validation fails, then e.Cancel = true; prevents from leaving the control. But when a user clicks Cancel button, then the form should

How to make HTML input tag only accept numerical values?

僤鯓⒐⒋嵵緔 提交于 2019-11-26 11:39:48
I need to make sure that a certain <input> field only takes numbers as value. The input is not part of a form. Hence it doesn't get submitted, so validating during submission is not an option. I want the user to be unable to type in any characters other than numbers. Is there a neat way to achieve this? Viral Patel HTML 5 You can use HTML5 input type number to restrict only number entries: <input type="number" name="someid" /> This will work only in HTML5 complaint browser. Make sure your html document's doctype is: <!DOCTYPE html> See also https://github.com/jonstipe/number-polyfill for