Spry textarea validation?
I have a form with a Spry textarea that needs to validate
character count. IE6 is not giving the "Maximum characters
exceeded" message (although it does work with a textfield).
Works like a charm in other browsers. Anyone have a
clue?
Never mind. After doing some experimenting, it turns out it's
something in my company's template that is conflicting with
something.
Now I just have to figure out what it is.
Similar Messages
-
Spry Textarea validation extension to prevent spam
I am using the fairly limited features of the spry framework in Dreamweaver to validate forms.
When I get to the textarea, validation is limited to:
required
min char, char count
AND NOT MUCH MORE!
I would like to continue to use the spry framework since it is pervasive inside DW CS4 and seems useful - BUT I need to be able to add functionality.
Specificly I would like to check the textarea for content matching a regx string. To determin if the form is getting hit by a spam bot.
I can do this in PHP, like so;
<?PHP
// Spam Detection code block
// The \b in the pattern indicates a word boundary, so only the distinct
//word "web" is matched, and not a word partial like "webbing" or "cobweb" */
// Check for html and img tags in string
function check($comment) {
// if(ereg('(href=\b|http\b|url=http\b|<a href|<IMG=|<img|img=|scr=|www\b)@i', $comment)) {
if (preg_match('(href=\b|http\b|url\b|http\b|<a href|<IMG=|<img|img\b|scr\b|www\b)i', "$comment")) {
// comment looks dirty, lets put up a bogus thankyou.
echo("<pre>
</pre><center> Thanks <p>We have received your comment and hope you enjoyed visiting our site. <p>To continue browsing, use the links above.</center>");
exit();
else{ // comment is clean of URLs
// End of Spam Detection code block
?>
Is there a way to integrate this code (or similar javascipt) into the Spry library, so I can do this in DW?
Anti spam technologies are a very important part of forms these days.
I hope other people value this request and pipe up about it.
Thanks
-Daniel HovissNever mind. After doing some experimenting, it turns out it's
something in my company's template that is conflicting with
something.
Now I just have to figure out what it is. -
Textarea validation with max only
How can I set up my textarea validation so that there is no
minimum but the IS a maximum number of characters?
I tried setting min to zero bas below but it doesn't work.
It gives an error unless I try ONE character.
var theDescription = new
Spry.Widget.ValidationTextarea("theDescription",
{useCharacterMasking:true, minChars:0, maxChars:180,
counterType:"chars_count", counterId:"Countvalidta1",
validateOn:["change"]});Hi Kate,
As Dragos suggested you should add the isRequired: false.
This will tell to the Validation Textarea to simply ignore the fact
the textarea value is empty.
Then if you completely remove the the minChars then you
should obtain the behavior you expected. If any numerical value is
passed through the minChars then the length of textarea value is
validated against that value. Instead if you remove the option the
Validation Widget will simply stop make the check.
Into the documentation you have detailed examples for the
different options that could be used for the textarea widget:
http://labs.adobe.com/technologies/spry/articles/textarea_overview/
Regards,
Cristian MARIN -
UI Datepicker and Spry textfield Validation
Hi, I am having a problem with using the UI Date picker and Spry textfield Validation together. I have created a sample form: 2 input boxe, the test box has the datepicker and spry validation and test2 has the date picker only,one submit button and some php code that echos the boxes values on submit.
My date picker is date formated as 'yy-mm-dd' for four digit year. My spry validation is formated 'yyyy-mm-dd' with validate on submit.
Now when I click on the test input box the datepicker comes up normally and i select a date. I then select the date on test2. Once I click the submit button the test field with spry validation come back saying a value is required and nothing else happens.
I was playing around and trying other things to get it to work and I noticed that when I select the test inputbox and the calander pops up if I enter some numbers into the text box then select a date from the datepicker then enter a date in the test2 inputbox and hit submit it works.
So it appears to me that the validation is not reading anything in the test field when I just select a date. Why is that? When I select a date it shows a date in the inputbox. It makes it hard to use the datepicker on a form.
Any help would be a preciated. Code is below.
Thanks Winrol
<?php echo "Test box 1 value = ". $_POST['test']. "<br/>" ?>
<?php echo "Test box 2 value = ". $_POST['test2'] ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="jquery-ui-1.7.2/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet" type="text/css" />
<link href="jquery-ui-1.7.2/css/base/ui.datepicker.css" rel="stylesheet" type="text/css" />
<link href="jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet" type="text/css" />
<link href="jquery-ui-1.7.2/css/base/ui.datepicker.images.css" rel="stylesheet" type="text/css" />
<style type="text/css">
/* BeginOAWidget_Instance_2137022: #datepicker */
#datepicker .ui-widget {
font-family: inherit;
#datepicker .ui-datepicker {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
#datepicker .ui-datepicker-title {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 1.1em;
color: #000;
font-weight: normal;
line-height: 1.8em;
#datepicker .ui-state-default, .ui-widget-content .ui-state-default {
border-color: #e6e6e6;
background-color: #e6e6e6;
color: #555555;
#datepicker .ui-state-default, .ui-state-default a {
color: #555555;
#datepicker .ui-state-highlight, .ui-widget-content .ui-state-highlight {
border-color:#FCEFA1;
background-color:#FCEFA1;
color:#363636;
#datepicker .ui-state-active, .ui-widget-content .ui-state-active {
border-color: #FFFFFF;
background-color: #FFFFFF;
color: #212121;
#datepicker .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus
border-color: #5F5F5F;
background-color: #5F5F5F;
color: #212121;
#datepicker .ui-widget-header
border-color: #5F5F5F;
background-color: #808080;
border-width: 1px;
/* Text attributes for the Days of Week Text */
#datepicker .ui-datepicker table th
font-size: .8em;
color: #000;
font-weight: bold;
/* EndOAWidget_Instance_2137022 */
</style>
<script type="text/xml">
<!--
<oa:widgets>
<oa:widget wid="2137022" binding="#datepicker" />
</oa:widgets>
-->
</script>
<script type="text/javascript">
// BeginOAWidget_Instance_2137022: #datepicker
$(function() {
$('input').filter('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
// EndOAWidget_Instance_2137022
</script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-color: #FFC;
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p>
<label for="test">test</label>
<span id="sprytextfield1">
<input name="test" type="text" class="datepicker" id="test"/>
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>
<p>
<label for="test2">test2</label>
<input name="test2" type="text" id="test2" class="datepicker" />
</p>
<p onclick="<?php echo $_POST['test'] ?>">
<input type="submit" name="submit" id="submit" value="Submit" />
</p>
</form>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "date", {format:"yyyy-mm-dd", hint:"yyyy-mm-dd"});
</script>
</body>
</html>This does work
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet">
<link href="jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet">
<link href="jquery-ui-1.7.2/css/base/ui.datepicker.css" rel="stylesheet">
<link href="jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet">
<link href="jquery-ui-1.7.2/css/base/ui.datepicker.images.css" rel="stylesheet">
</head>
<body>
<form action="" method="post">
<span id="sprytextfield1">
<label for="mydate">Date:</label>
<input id="datepicker" name="mydate" type="text">
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
<div id="datepicker" class="ui-glass-gradient ui-80TopTo0Bottom-gradient-header"></div>
<input name="mysubmit" type="submit">
</form>
<script src="SpryAssets/SpryValidationTextField.js"></script>
<script src="jquery-ui-1.7.2/js/jquery-1.3.2.min.js"></script>
<script src="jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js"></script>
<script>
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "date", {format:"mm/dd/yyyy", validateOn:["change"], useCharacterMasking:true});
$(function() {
$('#datepicker').datepicker({ showOtherMonths: false });
</script>
</body>
</html>
Gramps -
Hi, how can I modify this code for the spry textfield validation.js file? My text field is set to yyyy-mm-dd. When I enter a date and hit the submit button all works well but, how can I modify this portion of the .js file so the date yyyy-mm-dd is not less than today's date?
===================
'date': {
validation: function(value, options) {
var formatRegExp = /^([mdy]+)[\.\-\/\\\s]+([mdy]+)[\.\-\/\\\s]+([mdy]+)$/i;
var valueRegExp = this.dateValidationPattern;
var formatGroups = options.format.match(formatRegExp);
var valueGroups = value.match(valueRegExp);
if (formatGroups !== null && valueGroups !== null) {
var dayIndex = -1;
var monthIndex = -1;
var yearIndex = -1;
for (var i=1; i<formatGroups.length; i++) {
switch (formatGroups[i].toLowerCase()) {
case "dd":
dayIndex = i;
break;
case "mm":
monthIndex = i;
break;
case "yy":
case "yyyy":
yearIndex = i;
break;
if (dayIndex != -1 && monthIndex != -1 && yearIndex != -1) {
var maxDay = -1;
var theDay = parseInt(valueGroups[dayIndex], 10);
var theMonth = parseInt(valueGroups[monthIndex], 10);
var theYear = parseInt(valueGroups[yearIndex], 10);
// Check month value to be between 1..12
if (theMonth < 1 || theMonth > 12) {
return false;
// Calculate the maxDay according to the current month
switch (theMonth) {
case 1: // January
case 3: // March
case 5: // May
case 7: // July
case 8: // August
case 10: // October
case 12: // December
maxDay = 31;
break;
case 4: // April
case 6: // June
case 9: // September
case 11: // November
maxDay = 30;
break;
case 2: // February
if ((parseInt(theYear/4, 10) * 4 == theYear) && (theYear % 100 != 0 || theYear % 400 == 0)) {
maxDay = 29;
} else {
maxDay = 28;
break;
// Check day value to be between 1..maxDay
if (theDay < 1 || theDay > maxDay) {
return false;
// If successfull we'll return the date object
return (new Date(theYear, theMonth - 1, theDay)); //JavaScript requires a month between 0 and 11
} else {
return false;
======================
Thanks WinrolV1 Fusion wrote:
> Yes you can use regular expessions:
>
> function validatePhone(value){
> return
>
/^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?
>
\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3})
> )?$/.test(value)
> }
>
> var custom = new Spry.ValidationTextField(id, "custom",
{validation:
> validatePhone, validateOn:["blur", "change"]})
>
> regexp from
http://regexlib.com/
Excellent, thank you, that will get me in the right
direction. Its not
100%, but I think I can tinker with an expression to get what
I want.
The number is couldn't handle is +44 (0)113 255 7666 but its
not an
approved format anyway, but lots of companies still do it
this way, so I
want to ensure I get it right.
Thanks again!
Dooza
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html -
Conditional Spry Confirm Validation
Hi Chaps,
I know there are a few of these threads about, however, the answers usually point to a 404 webpage.
I'm after a conditional Spry Confirm Validation Text Field.
E.G. if a user decides to change a password, the (required) confirm validation comes into effect.
If anyone can point me in the right direction, it would help me out.
Many thanks
Samuelnever mind, found this: http://forums.adobe.com/message/2983481#2983481#2983481
-
TextArea Validation Widget don't function with Prototype
I have seen that TextAreaValidationWidget don't function
properly if is loaded also the Prototype library. To verify, I have
also simply insert this code in the HEAD section of the
FormsValidation Demo included in the framework:
quote:
<script type='text/javascript'
src='prototype.js'></script>
By adding this file, the validation of text field is running
properly but the validation of textarea doesn't. The Firefox
console of errors report:
quote:
Invalid Quantifier +);} catch (e) {if!=$continue) {throw
e;}}});} catch(e) {if(e!=$break){thow e; }} return this;}\b
in SpryValidationTextarea.js line 785
Do you know how to solve this?
I use Spry 1.4, prototype 1.5.0 (because I use also lightbox
2.0)Hi,
Based on a previous report we fixed this bug in the Spry 1.5
preview release. To fix this bug you should edit the
SpryValidationTextarea.js. Search for the:
Spry.Widget.ValidationTextarea.prototype.switchClassName =
function (className){
and inside you should see around line 763 the following code:
for (var k in classes){
if (classes[k] != className){
this.removeClassName(classes[k]);
This code should change to the following:
for (var k = 0; k < classes.length; k++){
if (classes[k] != className){
this.removeClassName(classes[k]);
Please let me know about your results.
Regards,
Cristian MARIN -
Spry Conditional Validation of Txt Boxes When Using Show/Hide
Hi everyone.. just a quick question (if their is such a thing) if that is ok...
I have been working on this single issue for 3 days.. it is driving me mad and hoped someone may be able to point me in the right direction...
I have a form and it has a radio button with 3 options (about relationship status):
Married
Defacto
Single
If they select married a text box appears with Enter spouses first name;
If they select defacto a text box appears with Enter partners first name..
If single no text box appears..
User then clicks on next to go to next page..
All good.. except.. I am using DW CS4 and using spry to validate both txt boxes (spouses first name and partner first name).. problem is only one will be displayed depending on the option selected – Married or defacto.. spry tries to validate both even the hidden one and therefore will not allow the user to go to next page.. as at least one not completed..
I have spent almost 3 days trying to write a php/java if statement to get spry to only validate text box 1 or 2 if radio button says married, defacto or single etc..
I would really really really apperciate your input about how I should do this as it is driving me nuts!!!
Anyway thanks and really hope to hear from someone..
Cheers from Downunder
UPDATE:
Been playing and got this to work:
<script type="text/javascript">
function decision(){
if(document.martial_status.martial_status[0].checked) {
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:blur});
//-->
sprytextfield1.reset();
} else if(document.martial_status.martial_status[1].checked) {
} else if(document.martial_status.martial_status[2].checked) {
window.alert("test3");
} else {
window.alert("Pick something!!");
// -->
</script>
BUT (and always a but).. if person goes back and selects say single rather then married after already clicking married the spry error msg is already in place for married.. and person cannot go to next page.. The joys.. tried martial_statur.reset and destroy and does clear the error message but still does not allow user to go to next page..
Any thoughts? Thanks in advance..You can destory the validation:
sprytextfield1.destroy();
and it should validate. -
Spry form validation working in IE but not in Firefox or...
Ok putting together a contact us form and would like a few
fields to be required. It works in IE7 but not in Firefox, Safari
or Google Chrome. In IE7 I get the error msg for no valid email but
in the other browsers it just does nothing. Here is the link to the
page
Aspen
Homes
Can anyone help with this? I have used Spry on a couple other
site and never had an issue. I am updated to the most recent
version also. I am running
Vista Ultimate (64-bit)
DW CS3 or DW CS4 (both do the same thing)
I have attached my code here in a txt file
Page
Code
thanks
BAnyone?
-
Function to call spry textfield validation
Hi every body.
I've a question for you.
I'm using a filed spry text field validation. It works perfectly when y press submit, but I need to do this:
I put some text in a textfield using PHP, the validation is only maked when I click the text field, or when the user press a key, but how to make a function to do the validation after I put data on textfield.Click the on Blur as per
Gramps -
Spry textfield validation for alphanumeric input
Hi,
How can I set the spry input to the following pattern that I need: only allow alphanumeric.You can build your own custom validations with Spry.
var custom = new Spry.Widget.ValidationTextField("id", "custom", {
validation: function( value, options ){
return /[a-z]/gi.test( value ); // your validation
Related reading: http://labs.adobe.com/technologies/spry/articles/textfield_overview/index.html and http://labs.adobe.com/technologies/spry/samples/validationwidgets/TextfieldValidationSampl e.html -
SUBMIT PROBLEM
I have a webpage in a .cfm (ColdFusion) format to be used in
a form. There are some Spry fields in it, like a validation text
field.
But I have some problems:
When the user enters a wrong email format, the form does not
do a submit. The form is good, but there is not any error message
to show the user that the entered email address is not correct
(Current error message is only for empty field).
Any suggestions on how to fix this problem?
Thanks"Merdad" <[email protected]> wrote in
message news:gmo4ab$a6$[email protected]..
> SUBMIT PROBLEM
>
> I have a webpage in a .cfm (ColdFusion) format to be
used in a form. There are
> some Spry fields in it, like a validation text field.
> But I have some problems:
>
> When the user enters a wrong email format, the form does
not do a submit. The
> form is good, but there is not any error message to show
the user that the
> entered email address is not correct (Current error
message is only for empty
> field).
>
> Any suggestions on how to fix this problem?
> Thanks
>
See if this helps:
http://blog.fusefly.info/index.cfm/2007/10/7/Using-CFFORM-and-Spry-validation
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com -
Hi All,
Have just implemented some spry elements into my site but
it's failing validation due to the spry.
there is no attribute "spry:region" and there is no attribute
"spry:repeat"
Anybody know of any work arounds for this?
Cheers,
Simonhttp://labs.adobe.com/technologies/spry/articles/best_practices/validating_spry.html
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Fordwebs, LLC
http://www.fordwebs.com
"simonEntertainmentStore"
<[email protected]> wrote in message
news:g5gufr$6ps$[email protected]..
> Hi All,
>
> Have just implemented some spry elements into my site
but it's failing
> validation due to the spry.
>
> there is no attribute "spry:region" and there is no
attribute "spry:repeat"
>
> Anybody know of any work arounds for this?
>
> Cheers,
>
> Simon
> -
Spry Form Validation doesn´t with PHP
Hi guys!
Houston, I have a problem!
Description:
I used a validation form for an e mail text field that works on .html file but not on a .php file.
What I did?
1. I created my .html file and code all the Spry Valitation Form. If you test it, it works. This is the testing site link:
a. http://www.rayacosta.com/clientes/pparquitectura/v1/contactoT.html
b. The e mail field it´s the one that I’m validating.
2. I created 2 include files from the first one. One with the header info in header.php and another called footer.php. I need to use PHP to generate the form, so I thought it was the best way to go.
3. I create a contato.php file with:
a. header.php (here I included the links for the Spy Assets)
b. footer.php (with the footer info).
4. Here the file just doesn´t work. This is the link:
http://www.rayacosta.com/clientes/pparquitectura/v1/contacto.php
5. Any clues? I understand that Dreamweaver doesn´t show the Spry UI in the php file. But it supposed to be compiled correctly on the browser agent. The other files just work fine, but not this contact form.
6. In Dreamweaver, if you see at the header.php file, the link to the js file is not totally brown like in its html version.
I really appreciate some light in this matter.
Thanks in advanced,
RayTwo possibilities that I can see.
1: Your HTML code has some JavaScript right near the bottom. This appears to be related to the Spry Validation of the email field. This same script does not seem to be in the PHP file.
2: Are the "header" and "footer" in the same folder as the contact page? If not (ie: if in an "files" or "includes" folder") the path to the spry files in the header would be wrong.
For example, if the header file is one folder deep, change this:
"_spryAssets/SpryValidationTextField.js" to "../_spryAssets/SpryValidationTextField.js"
When you view source when looking at a page, you can see the page as it is generated. Quite often it will reveal what is missing.
Good luck. -
Spry textfield validation with custom pattern
I have sussed out the standard custom pattern, and how to
enforce it,
but what I would like to know is how can I allow any numbers,
including
spaces, brackets, or plus sign, but no letters?
This is for a phone number entry field, where it could be an
international phone number or a standard one for the UK,
where the
length can vary, depending on where you live.
http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom)
Any ideas?
Dooza
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.htmlV1 Fusion wrote:
> Yes you can use regular expessions:
>
> function validatePhone(value){
> return
>
/^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?
>
\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3})
> )?$/.test(value)
> }
>
> var custom = new Spry.ValidationTextField(id, "custom",
{validation:
> validatePhone, validateOn:["blur", "change"]})
>
> regexp from
http://regexlib.com/
Excellent, thank you, that will get me in the right
direction. Its not
100%, but I think I can tinker with an expression to get what
I want.
The number is couldn't handle is +44 (0)113 255 7666 but its
not an
approved format anyway, but lots of companies still do it
this way, so I
want to ensure I get it right.
Thanks again!
Dooza
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html
Maybe you are looking for
-
Where can i find the Datewise stock for a particular material
Hello friends, In which table i can find the stock of a particular material on particular date?.MARD, MCHB these all tables gives the current stock of material.But i want to find the stock of material on particular date.In Report MB5B and MC.9 we can
-
Form Field Mode in Acrobat X Standard?
My company is currently using Acrobat 9 Pro to design forms and we're constantly using the "Add or Edit Form Fields" function. We also resize, and modify the properties of each form field in "Form Field mode". Are these features found in Acrobat X St
-
How to display the Hierarchy Node Level in BEx
Hi Folks, In my report I have a Hierarchy. I have to display the Node level of the Hierarchy in the output. For Eg: If I have BB under AA root node then in the output it should display Level 1 for AA and Level 2 for BB. Thanks in Advance. Re
-
Annotating in Keynote while presenting
I am trying to replace the SmartBoard in my classroom with an iPad and an HDTV as the resolution from my projector is poor. The only issue that is inhibiting my switch is the ability to play a keynote presentation and annotate slides as I'm lecturin
-
SWF poor quality and poor lip sync?
I normally use After Effects and today is my first time experimenting with Flash. I create virtual presenters that are filmed against a green chromakey screen. I use Keylight in AE to key the green and replace it with different backgrounds. These are