Required "#" mark in email input field - javascript

I just have one quick question, how do I check if my input contains some mark, like "#"?
I can submit my form under 5 conditions and one of them is that my email input has to contain "#" mark, but I can't find any info how to do this!

You could use
inputValue.indexOf('#')
See here for more details
http://www.w3schools.com/jsref/jsref_indexof.asp

Related

How to get xpath contain both text in 2 line break

I have a content like this
How can I get that xpath to assert in one for both The email field is required. and The Password field is required.
thanks you so much
The simplest XPath to assert both these texts is:
"//*[contains(.,'The Email field is required')][contains(.,'The Password field is required')]"
You can make it more precise by specifying the tag name div
"//div[contains(.,'The Email field is required')][contains(.,'The Password field is required')]"

Replace underscores on typing input in JavaScript

I have a text field with little dashes/underscores as shown in the image. How do I use JavaScript/backbone.js to make these dashes to be replaced by the input number upon typing?
As I type, I want the underscore to be replaced with the number I type. How do I achieve this?
Thanks in advance
input invoice field

HTML input element password pattern with alphabet and number range

I know this may be very simple but I couldn't find anything relevant. I am using the HTML element for accepting the password from the user.
There is a condition for the password to be accepted
It should only contain letters between a to h (0 times or more)
It should only contain numbers between 1 to 8 (0 times or more)
Following the above two conditions the user can come up with any password combination. For example: abc123, 6ad27, hefb etc etc which should be accepted by the input element.
But it should not accept patterns like z00911, ksoql234 etc.
What should be the value for pattern attribute in the following code snippet for checking the above two conditions?
<input type="password" pattern="WHAT-SHOULD-I-PUT-HERE">
I hope someone might help. Thank you
<form action="/blablabla">
<input type="password" pattern="[a-h1-8]+" required="required" title="Wrong password">
<input type="submit">
</form>
In regular expression [a-h] means range of character, you can define multiple ranges in square brackets: [a-h1-8]. If you want to allow repetitions of pattern you add *(0 or more repetitions) or +(1 or more repetition) after pattern. Your pattern for single letter is [a-h1-8] so for password containing at least on character full pattern is [a-h1-8]+. You can read more here.
I have also added required attribute to enforce filling password field, without that attribute user could simply leave password blank.
You can handle this problem easily with javascript functions such as onChange event on your input tag.
Every onChange event you can check the last added character or letter whether meets your conditions.

How to make a PDF form with javascript to concatenate two fields on click OK?

i want two concatenate the Username + Email Domain , On click OK button
and Display result in Below Full Email field.
Javascript Code to do that please help
In the Full Email field, add the following JavaScript to the mouse up action. You may need to edit the field names to match yours.
this.getField("Full Email").value = this.getField("username").value+this.getField("Email Domain").value

PHONE VALIDATION: How To Overwrite Text In a Textbox When Typing Without Clearing Whole Field?

I would like to know how to create a script that overwrites text that is already in a text box. (in jquery or javascript)
Example: If I have a text phone field that says:
+1 (xxx) xxx-xxxx
When a user clicks the field, I want the characters to remain, and the focus set to the 4TH character in the text box, just after the 1.
Then, as a user types each number, it overwrites the x one by one, until all the x's are gone. But, I want the parenthesis and hyphen formatting to stay, so the users input forms around the formatting.
I would also like this form to only allow numbers, hyphens, and parenthesis, and not allow submitting if x's still exist.
If you can help me with this, THANK YOU! :-)
Try masked input plugin # [
http://digitalbush.com/projects/masked-input-plugin/
]1
Looks like it matches what you need.

Categories

Resources