You are developing a customer web form that includes the following HTML.
<input id=”txtValue” type=”text” />
A customer must enter a valid age in the text box prior to submitting the form.
You need to add validation to the control.
Which code segment should you use?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
I’m really not sure about D, that regex flags input like 90,90,80000.2343.234 as correct… Is 90,90,80000.2343.234 a “valid” age?
Seems like the question’s text not related with image
It’s surely B
Funny as hell. 12939123.19239,1293 return: non existing object. GODDAMN
@Alex, no it is not B. B checks only whether or not the input is empty. D checks if a number is entered. Okay the regular expression of D is not completely correct, but it is the answer that approaches the correct answer the most.
Perhaps the user expresses their age as a string e.g. “seventy”.
It should be clear that the data input should be numeric