JQuery :: Validate: Require A Specific Word Or Phrase?
Aug 30, 2010I want to add a simple alternative to CAPTCHA on a form by adding a required text input - e.g.Type the word "jquery":How do I add a rule requiring a specific value?
View 5 RepliesI want to add a simple alternative to CAPTCHA on a form by adding a required text input - e.g.Type the word "jquery":How do I add a rule requiring a specific value?
View 5 RepliesI am looking for a way to search another site for a specific phrase.
People are linking to my site and then I have to ask them for the page where they linked and go validate that it's there. I'd like to automate this process.
I'm trying to set up a form that has a text field that is required to be blank - I'm dealing with form spam, and the bots are stuffing every text field with random crap. So, I have a text box that is required to be blank. But I can't get jquery.validate to understand both required and blank.the text input is has a name and id of live_check.I have added this method:
$.validator.addMethod("equalToParam", function(value, element, param) {return value == param;});
and then my rules look like this:
rules: {
first_name: "required",
last_name: "required",[code]...
But validate flags the empty text box as invalid (because it's required?)
I have a working example of jQuery validate working in the link below. The newsletter checkbox is required and working. However, the "colors" checkboxes are all named as an array ( ex: name="color[]" ), and so the problem lies in the validation code, where it uses the name of the element to require elements ( ex: newsletter: "required" ).
Code JavaScript:
<script>
$("#testform").validate({
[code].....
Info:- jquery-1.3.2- jquery.validate-1.5.5- form with 1 dropdown select and 4 text inputsSetup:- all 4 text fields are not initially required.Issue:The first input element is a required dropdown select.If the user selects option 1, then text field 1 & 2 need to be
required.If the user selects option 2, then text field 3 & 4 need to berequired.How do code this?
I have a simple form with a sum.
Sum is 4 + 1 = ... the answer will of course be 5.
Does any one know of a simple tutorial where a specific number can be entered into a text field. If number is incorrect it pops up a simple error box.
I have an issue with a registration form. What I would like to do is only allow a certain email domain in the 'email' field. Eg. Only allowing @gmail.com email addresses, and all others would receive an error. This is the line of code that I believe needs changing:
function isEmail(valor){if(/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,4})+$/.test(valor)){return(true)}else{return false;}}
I am not too familiar with this but through my hours of research, I believe that I need to add something to this line.
I am having no luck with my post form to mysql. It is only posting the first letter of the word/phrase for the text input fields to the mysql database. It is a photo and text post form. The photo and only first letter of text are posting to database. I am using Jqtouch, jquery, and phonegap.
Here is my form fields:
Here is my java script:
I have 2 radio buttons:
[Code]...
If I have an 'dynamic' Div that sometimes contains the word Red or sometimes contains the word Green, i would like to replace (or something) the ID to something else.If the word inside the div is Green I need to use a green background, but if the word is red in the div, i need to have it in a red background.
<div id="x">Green</div>
<style>
#y {
background-color:Red;
[code]....
Can JavaScript find a specific word (the word "blue", for example) and hide it from view?
View 4 Replies View Relatedcode for a inserting a hyperlink at each occurrence of a specific word. I searched throughout the forums and couldn't find anything, but then again I probably don't know which particular code to use.
View 6 Replies View RelatedI'm having an issue with doing a simple js task. I have a list of hyperlinks that contain various paths. For instance:
a href="[URL]
a href="[URL]
What I need is to remove the term "content" from all the hyperlinks in it's contain div. There is got to be a simple way of doing this and I can't seem to find the right direction. I also need to have the targets changed as well, which I was able to complete.
window.onload = function(){
var anchors = document.getElementById('containerDiv').getElementsByTagName('a');
var links = "content";
for (var i=0; i<anchors.length; i++){
anchors[i].setAttribute('target', '_blank');
} }
i have a site that contains only links from facebook, and when a user adds a link i want to validate that its going to be a link from facebook so the link must start with [URL] or [URL]
View 1 Replies View RelatedI am using the validate plugin [URL].My problem is I have 2 different SUBMIT buttons in the same form. On the server-side I detect which one was clicked and do different things.For one of the 2 buttons, I don't want to validate the form.
View 1 Replies View RelatedI need to validate an email with a user specific suffix and the email textbox need to have this email suffix whih cannot be deleted, user can only add the prefix and the suffix remains unedited [code]
View 1 Replies View Relatedhere is my current email validation code:
function validateEmail(strValue) {
var objRegExp = /(^[a-z]([a-z_.]*)@([a-z_.]*)([.][a-z]{3})$)|(^[a-z]([a-z_.]*)@([a-z_.]*)(.[a-z]{3})(.[a-z]{2})*$)/i;
return objRegExp.test(strValue);
}
what should i add to reject email addresses from hotmail.com and yahoo.com?
ok so I know how to do substring to read everything before a certain phrase however is there a way to read everything after a certain phrase? Ex of what this script reads and doesent read
Alex was slain by dog
Bob was slain by cat
Alex & Bob = "Var CharName" My substring reads this in this line:
Var Charname
CharName = msg.substring(0, msg.indexOf(" was"))[code].....
I haven't really used javascript before except for the odd snippet, and I was wondering if anyone can help me with a problem I have:
I need a script that chooses a phrase at random from 4 pre-defined lists of phrases, and does it all from the one page - rather than a separate page and a separate script for each pre-defined list of phrases.
I hope this is clear enough! Here is an example to illustrate what I mean:
This would be the text that appears on the webpage:
Click here for random Phrase Type 1
Click here for random Phrase Type 2
Click here for random Phrase Type 3
Click here for random Phrase Type 4
When clicking the first option, it only chooses from pre-defined list #1, the second option only chooses from pre-defined list #2, and so on.
It then displays the randomly generated phrase in one separate box, no matter what pre-defined list was chosen. (Although if each phrase has to be displayed in 4 separate boxes, that'd be ok too.)
I am trying to find a word inside a string.the search his going fine but I need to know which word has been found in the string.
Code:
Code:
Now in the string only one value can be found at a time.So its either a1 or a2 or so on.....
How can I grab the keyword phrase that someone used to enter the website and then pass that through a form? I would need to know for search engines and Google AdWords as well. Does anyone know how to do this?
View 5 Replies View RelatedSo I understand you can do:
$(".className").xxx.
Is there an easy way with jquery to have it match 2 classes. So maybe I only want the action to take place it the element has class1 and class2.
$(".class1" , ".class2").xxx
The above is close to what I would like, but thats if any of the 2 classes match, go. I need it to be both. I can probably do this with some basic javascript logic.. just figure there may be a function for this already.
As you can see below in example #1I am attempting to assign a variable value to the 'URL:' key. I am having problems with this Ajax call but I don't know if this is the cause. I even tried using eval() in example #2 below. I am pretty new at this stuff so forgive my ignorance.
Does the 'url::' key REQUIRE a literal string?? Is there no way to set this value at run time?
[Code]...
I don't quiet understand how to require a valid email address to be entered into a particular field.
There is documentation for what I wish to achieve here[code]...
But I'm having trouble understanding it.
For a start, I can't quiet tell from examining the demo how a particular field is required to have a valid email address.
I can't tell how the script picks up which particular fields are required to have which rules.
I prepare a contact us page for my site.URL...when click on submit button 2 or more times the message is set for require field is increasing.
View 1 Replies View Related<div class="box top"></div>
<div class="box main">
<div class="box header">
<div class="badge"><ul><li class="active"><span>60</span></li></ul></div>
[Code]....
What is happening is $(this) is no longer based on .expand being the (this) that is clicked.
like if i have a button SOMEWHERE randomly on the page with this
<div onclick="Minimize('_alerts');">Click Here</div> this will minimize alerts but because the (this) in minimize function doesn't actually point to the right button that I want to add a class to.
Is there a way to modify the minimize function so that it finds the <div id="mytoggle"><ul> <li class="expand boxminimize" rel="_alerts"> using the rel toggle, and then changes the class of the li from expand boxminimize to boxexpanded??
just like the .expand click function I posted on the top of the post that works?