logo
down
shadow

validation rule needed for only numbers to be entered


validation rule needed for only numbers to be entered

Content Index :

validation rule needed for only numbers to be entered
Tag : chash , By : Jenuel
Date : November 26 2020, 09:01 AM

help you fix your problem Hi I have a program which allows users to choose from options 1,2 and 3 which is userChoice. However when I enter a number that is higher than 3 or a letter instead of a number the program crashes or exits. I was wondering is there a validation rule that could be put in place so number 1 to 3 can only be entered. , You can use a simple if statement like this:
...
string userChoiceSTR = Console.ReadLine();

if(userChoiceSTR != "1" && userChoiceSTR != "2" && userChoiceSTR != "3")
{
    Console.WriteLine("You need to provide a value between 1 and 3");
    //Handle the case of invalid input (e.g. return)
}
...

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

bassistance validation help needed for australian phone numbers


Tag : jquery , By : Nate Bedortha
Date : March 29 2020, 07:55 AM
around this issue Regex would be /^[0-9]{10}$|^\(0[1-9]{1}\)[0-9]{8}$|^[0-9]{8}$|^[0-9]{4}[ ][0-9]{3}[ ][0-9]{3}$|^\(0[1-9]{1}\)[ ][0-9]{4}[ ][0-9]{4}$|^[0-9]{4}[ ][0-9]{4}$/
And you'll want to change the a.length>9 to a.length>14 since something like (09) 9999 9999 would be a valid number.
jQuery.validator.addMethod("phoneAus",function(a,b){return this.optional(b)||a.length>14&&a.match(/^[0-9]{10}$|^\(0[1-9]{1}\)[0-9]{8}$|^[0-9]{8}$|^[0-9]{4}[ ][0-9]{3}[ ][0-9]{3}$|^\(0[1-9]{1}\)[ ][0-9]{4}[ ][0-9]{4}$|^[0-9]{4}[ ][0-9]{4}$/)},"Please specify a valid mobile number");

Does one validation rule suppress the other validation rule in jquery validation plugin?


Tag : jquery , By : Justin Bowers
Date : March 29 2020, 07:55 AM
I wish this help you As Tim correctly points out, the ^ caret is only a metacharacter when it is the first char in a character class.
One thing that can help when writing a regex is to write out, in english (or your native language of choice), exactly what the regex matches. Lets do that with your two regexes:

Laravel Rule Validation for Numbers


Tag : php , By : Ambarish Singh
Date : March 29 2020, 07:55 AM
This might help you I have the following Rule : , If I correctly got what you want:
$rules = ['Fno' => 'digits_between:2,5', 'Lno' => 'numeric|min:2'];
$rules = ['Fno' => 'numeric|min:2|max:5', 'Lno' => 'numeric|min:2'];

Laravel Validation not between in range of numbers (opposide of between rule)


Tag : laravel , By : Olexiy P.
Date : March 29 2020, 07:55 AM
help you fix your problem I wouldn't say that's a dirty way, however I would also consider using the Greater Than rule if I know that 1-14 are not allowed:
'role' => 'required|gt:14',
'role' => 'required|integer|gt:14',

ISNUMBER() validation rule for numbers


Tag : validation , By : Novi Indrayani
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • dynamically add images to view
  • Are static extension methods on User object safe?
  • Process thousands of database calls simultaneously
  • Trying to decrypt a string with public key(not private) using bouncycastle in .net
  • How to retrieve the name of an usb device
  • Query many-to-many related data using Entity Framework Core
  • ASP.NET MVC : how to find the view from a controller?
  • Inconsistent behaviour using Entity Framework for ASP.NET MVC app vs windows service
  • AutoFixture Customize vs Build
  • How to change textbox location at the click of a mouse in live mode?
  • How can I deserialize a XML file without defining the parent node?
  • asp.net core how decrease class coupling
  • ASP.NET Core Razor Pages Routing With parameters
  • String Escaping With $ Interpolation and @ Encoding
  • ConfigurationManager in ASP.NET WebAPI tested with HttpServer
  • Top down shooting in Unity 2D don't work as I want it to
  • Use own redirectUri when the Authentication expires
  • Using "foreach" in string array c#
  • "Object reference not set to an instance of an object" for create multiply models on one view
  • Get data passed trought pushAsync
  • Selector expression dynamic on IQueryable
  • Logut with SignInManager not calling method
  • Exit event handler with MessageBox OK button
  • Can not load view from Custom Renderer Xamarin Forms
  • Looking for a .Net ORM
  • Cost of SortedDictionary.Count
  • All possible combinations of n items selected randomly from a set of x items (algorithm)
  • Displaying process percentage on DOS screen
  • C# Importing Large Volume of Data from CSV to Database
  • c# control location precision
  • Printing to Zebra printer gives faint and blurry images
  • How to avoid stepping into dll code file?
  • Programmaticaly prevent Vista desktop search (WDS) from indexing pst files placed on mapped network drives
  • Is there anyway to reduce IsolatedStorage capacity in Silverlight?
  • C#: How to print a unicode string to console?
  • Frequency Table with Random Values
  • My Visual Studio 2008 web application keeps throwing a .Net error when I first run it, but refreshing fixes it
  • TCP Connection Creation and Closing Event Hooking
  • Find changed properties of a class
  • C#: Object with custom marshaller not containing data after PInvoke call
  • Version Control System with API. Need to get metrics
  • Performance comparison of Dictionaries
  • How to get process name and title of the top window on Windows / C#
  • How to save the ListView contents to a text file?
  • Why not .NET-style delegates rather than closures in Java?
  • Get CLSID by PIA interface Type
  • Visual Studio 2008 C# - Recover solution from application manifest possible?
  • Is a good practice to initialize private data members from within ctor by calling the associated properties instead of t
  • Inserting into a bitstream
  • How do you write byte[] array using log4.net
  • Clickonce + .NET client profile 4 framework + offline
  • Show form that showDialog from mainForm won't block it, but closing mainForm will close it
  • Developing a GPS car tracking system
  • dynamic log4net appender name?
  • Visual studio formatting issue
  • IndexOutOfRangeException when a stream is a multiple of the buffer size
  • How to deal with calculated values with Dependency Properties on a custom WPF control
  • counting from textbox,asp.net
  • Threading best practice when using SFTP in C#
  • how to load PDF file in website page using C#
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com