I am using tagsInput Api in Angular
here is link
i want to add a tag on space. but it is not working.
here is my code
<tags-input ng-model="emails" placeholder="Add an Email" [add-on-space="true"]>
Also i want to add Email validator in tags . i have no idea.
Any idea how to do this ?
Thanks
Try dropping the square brackets from your attribute. e.g.:
<tags-input ng-model="emails" placeholder="Add an Email" add-on-space="true">
Square brackets are just used in their documentation to indicate the ones that are optional. In its current form, your HTML isn't valid.
To validate emails, try the "allowed-tags-pattern" attribute with regex, as below:
<tags-input ng-model="emails" placeholder="Add an Email" add-on-space="true" allowed-tags-pattern="^[a-zA-Z0-9_.+-]+#[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$">
Hope this helps.
Related
I'm having trouble because of the escape string issue.
The value stated in action is like below:
myVo.title = "[M&M]Title";
And I want to use it in JSP like below:
<s:textfield name="title" id="title" value="%{myVo.title}" />
but what I got is this:
I searched about this problem, but I got no clear answer.
There're some attributes for escape issue like escape/ecapeHtml/escapeXml
but those all are for property tag, not for textfield tag.
How can I solve this problem?
Any comment would be appreciated. Thanks.
You have to disable escape like this:
<s:textfield name="title" id="title" value="%{myVo.title}" escape="false"/>
I am trying to use a regular expression to validate an email address. It does not seem to be doing any validation at all. When I load the page the Submit button is disabled because of the $pristine but as soon as I type a letter the button becomes enabled. Also I am aware that the regex is only accepting upper-case at the moment. The following code is my form:
<form name="myForm" ng-hide="email" >
Insert Email : <br/>
<input type="text" name="email" ng-pattern="/^[A-Z0-9._%+-]+#[A-Z0-9.-]+\\.[A-Z]
{2,4}$/" ng-model="insert_email" required>
<br/>
<button ng-hide="email"
type="submit"
ng-disabled="myForm.email.$pristine || myForm.email.$invalid">Submit</button>
</form>
I am not sure but I think the problem may lie with the regex itself.
take out the email in myForm.email.$pristine and in myForm.email.$invalid
to look like:
myForm.$pristine
and
myForm.$invalid
also try with ng-required instead of required
It seems to be two things. It looks like the ng-pattern expects an expression instead of a string attribute.
So you need to wrap it in a string if you want to use an inline expression.
Like so:
ng-pattern="'^[A-Z0-9._%+-]+#[A-Z0-9.-]+\\.[A-Z]{2,4}$'"
Also, there seems to be some issues with your regex. I changed it to this:
ng-pattern="'^[a-zA-Z0-9._%+-]+#[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$'"
It seems to work.
Plunker Demo
I am using the nifty parsley js As you can see in the documentation
there is only data-parsley-type="alphanum" which allows numbers and letters. I am trying to create fields that ONLY allow letters.
Anyone know how to do this?
You could use a pattern:
data-parsley-pattern="^[a-zA-Z]+$"
You can use such input validator, in order to obtain an only letter field.
<input type="text" class="form-control" required data-parsley-pattern="^[a-zA-Z ]+$" placeholder="Type something" />
While trying to validate URL input by user in ValidationTextBox but there is nothing I could find for validating URL input like "www.google.com" and "http://www.google.com"
<input dojoType="dijit.form.ValidationTextBox" regExp="dojox.validate.regexp.url" tooltipPosition="below" required="true" placeHolder="Enter Rule url" type="text" name="ruleUrl" id="ruleUrl">
The above doesn't work. Any alternative for validating URL's?
Are you sure you added dojox/validate/regexp to your modules in a require()? Because the code seems to work perfectly. I also made an example JSFiddle.
I am generation dynamic content using javascript and inside that content a part will be like
onfocus="if(this.value=='Enter Email Address'){this.value='';}" onblur="if(this.value=='') {this.value='Enter Email Address';}" value="Enter Email Address"
I want above code but after generation of the content but all the single quotes are not showing properly. Please help me out. Thanks
If you're working in HTML 5 with input element, i would suggest you to look at the placeholder attribute, as this is exactly what you are needing for. No javascript needed.
<input type="text" placeholder="Enter Email Address" />
use Escape character \
'\\'Enter Email\\''
try this
'\'Text\''
or
"'Text'"
try something like this , Remove backslash from double quotes,FIDDLE
<input type="text" onfocus="if(this.value=='Enter Email Address'){this.value='';}" onblur="if(this.value=='') {this.value='Enter Email Address';}" value="Enter Email Address">