hi guys,
i have simple form containing 2 x multiple selects -
products_available and products_selected. products_selected is
populated from a query.
problem: the products_selected select will not pass any pre-populated
items when the form is submitted. it will only work if i pass them
back to products_available and then back again??
the code i have to initialise qforms is...
<SCRIPT LANGUAGE="JavaScript">
<!--//
// initialize the qForm object
objForm = new qForm("related_product_form");
// make the User field a container, this will ensure that
the "reset()"
// method will restore the values in the select box, even if
they've
// been removed from the select box
objForm.products_available.makeContainer();
// setting the "dummyContainer" property to false will ensure
that no values
// from this container are included with the value
objForm.products_available.dummyContainer = true;
// make the "Members" field a container--every item in
the "Members" select box
// will be part of the container, even if the item isn't
selected.
objForm.products_selected.makeContainer();
stProductsSelected = new Object();
<cfoutput query="getRelated">
stProductsSelected["#getRelated.product_idfk#"]
= "#getRelated.product_title#";
</cfoutput>
objForm.products_selected.populate(stProductsSelected);
//-->
</SCRIPT>
The fields are actually retrieved via Ajax, rather than being created via DOM.
I track the
fields in a Javascript Array and then loop over this array of objects during the
initialization
of my qForm object. Everything is fine until I try to apply a validation
method.
initQForm = function(){
pForm = new qForm('modForm');
pForm.txtModuleKeyword.description = 'Module Keyword';
pForm.txtModuleKeyword.validateAlphaNumeric();
pForm.txtModuleTitle.description = 'Page Title';
pForm.txtTemplateAreaKeyword.description = 'Template Area';
pForm.required('fkIntPageTemplateId,txtModuleKeyword,txtModuleTitle,txtTemplateA\
reaK
eyword');
//loop over the page content objects retrieved via Ajax
for(i=0; i < pgContent.length; i++){
pForm[pgContent[i].contentkeyword].required = true;
pForm[pgContent[i].contentkeyword].description =
pgContent[i].templatekeyword + ' Content Keyword';
//pForm[pgContent[i].contentkeyword].validateAlphaNumeric();
pForm[pgContent[i].name].required = true;
pForm[pgContent[i].name].description = pgContent[i].templatekeyword + '
Content Name';
pForm[pgContent[i].content].description = pgContent[i].templatekeyword + '
Content';
}
}
>I have a rather complex form that dynamically creates a variable number of
>text fields.
>Applying a qForm object, setting description and required values for these
>fields was
>working fine until I tried to add AlphaNumeric validation. I now get an
>infinite loop of 'Out of
>Memory' errors in Safari and Firefox crashes so hard I can't get any more
>details on the error.
>Any ideas?
What's your generated code look like (the code the browser sees?)
-Dan
I have a rather complex form that dynamically creates a variable number of text
fields.
Applying a qForm object, setting description and required values for these
fields was
working fine until I tried to add AlphaNumeric validation. I now get an
infinite loop of 'Out of
Memory' errors in Safari and Firefox crashes so hard I can't get any more
details on the error.
Any ideas?
Thanks very much for your reply., I assumed that I'd have to modify the framework files; I just couldn't find exactly where the focus() code was. Hmmmm... I was sure I looked at the prototype checkForErrors method. Oh, well. I hate to modify core files, but in this particular case, it'll be fine. it's the behavior this client wants throughout his application.
Thanks again for your explanation.
On Mon, Feb 25, 2008 at 4:40 PM, Dan G. Switzer, II <dswitzer@...> wrote:
Tom,
There isn't a good way to alter this behavior--other than modifying the
code. In the core.validation.js there a method called:
Field.prototype.checkForErrors
You can either comment out line 286 (this.setFocus();) so that the focus
isn't reset or you can override that method with the same code minus the
this.setFocus() line.
If you go the override method, just make sure the override method is defined
after the core.validation.js file is doing.
-Dan
>-----Original Message-----
>From: qformsapi@yahoogroups.com [mailto:qformsapi@yahoogroups.com] On
>Behalf Of Tom McNeer
>Sent: Friday, February 22, 2008 5:17 PM
>To: qformsapi@yahoogroups.com
>Subject: [qformsapi] Don't want focus after forced validation
>
>This may sound a little odd, since forced validation should be just
>that. However, the behavior of qForms, when 'validate=true' is set for
>a field, is to run the validation, show an alert if the validation
>fails, and place focus back in the field being validated.
>
>Perfectly sensible. However, since this behavior keeps the user from
>moving to another field without entering a valid value, this can
>cause some frustration.
>
>My client wishes to use the validations onBlur() (as well as
>onSubmit()) since his forms have many fields with many different types
>of validations. So alerting the user to a problem onBlur is handy.
>
>However, he would still like to allow the user to go on and fill out
>other fields, find the value for the missing fields in his records
>(which may be handwritten), then add the value.
>
>Seems to me that all that needs be done is NOT to place focus back on
>the invalid field. The alert should fire onBlur and onSubmit; the
>error color should show; but refocusing should be disabled.
>
>Problem is, although this seems simple, I can't figure out where in
>the code (2.0) I could go to disable the focus event. Or is there
>actually an API method to do this?
>
>Thanks for any help.
>
>
>Tom McNeer
>
>
>
>
>
Tom,
There isn't a good way to alter this behavior--other than modifying the
code. In the core.validation.js there a method called:
Field.prototype.checkForErrors
You can either comment out line 286 (this.setFocus();) so that the focus
isn't reset or you can override that method with the same code minus the
this.setFocus() line.
If you go the override method, just make sure the override method is defined
after the core.validation.js file is doing.
-Dan
>-----Original Message-----
>From: qformsapi@yahoogroups.com [mailto:qformsapi@yahoogroups.com] On
>Behalf Of Tom McNeer
>Sent: Friday, February 22, 2008 5:17 PM
>To: qformsapi@yahoogroups.com
>Subject: [qformsapi] Don't want focus after forced validation
>
>This may sound a little odd, since forced validation should be just
>that. However, the behavior of qForms, when 'validate=true' is set for
>a field, is to run the validation, show an alert if the validation
>fails, and place focus back in the field being validated.
>
>Perfectly sensible. However, since this behavior keeps the user from
>moving to another field without entering a valid value, this can
>cause some frustration.
>
>My client wishes to use the validations onBlur() (as well as
>onSubmit()) since his forms have many fields with many different types
>of validations. So alerting the user to a problem onBlur is handy.
>
>However, he would still like to allow the user to go on and fill out
>other fields, find the value for the missing fields in his records
>(which may be handwritten), then add the value.
>
>Seems to me that all that needs be done is NOT to place focus back on
>the invalid field. The alert should fire onBlur and onSubmit; the
>error color should show; but refocusing should be disabled.
>
>Problem is, although this seems simple, I can't figure out where in
>the code (2.0) I could go to disable the focus event. Or is there
>actually an API method to do this?
>
>Thanks for any help.
>
>
>Tom McNeer
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
This may sound a little odd, since forced validation should be just
that. However, the behavior of qForms, when 'validate=true' is set for
a field, is to run the validation, show an alert if the validation
fails, and place focus back in the field being validated.
Perfectly sensible. However, since this behavior keeps the user from
moving to another field without entering a valid value, this can
cause some frustration.
My client wishes to use the validations onBlur() (as well as
onSubmit()) since his forms have many fields with many different types
of validations. So alerting the user to a problem onBlur is handy.
However, he would still like to allow the user to go on and fill out
other fields, find the value for the missing fields in his records
(which may be handwritten), then add the value.
Seems to me that all that needs be done is NOT to place focus back on
the invalid field. The alert should fire onBlur and onSubmit; the
error color should show; but refocusing should be disabled.
Problem is, although this seems simple, I can't figure out where in
the code (2.0) I could go to disable the focus event. Or is there
actually an API method to do this?
Thanks for any help.
Tom McNeer
Wouldn't this work? myForm.myField.setValue(''); myForm.myField.required = false;
----- Original Message ---- From: adam.euans <adam.euans@...> To: qformsapi@yahoogroups.com Sent: Wednesday, January 23, 2008 8:45:27 AM Subject: [qformsapi] qForms v2 removeValidation()
I recently required the use of a removeValidation( ) on the fly function
and was unable to find something that would work - so I came up with
something.
file: /lib/api/core. validation. js
Updated (line 115):
> this.qForm.$ queue.validation [this.qForm. $queue.validatio n.length] =
new Array(this.name, fn);
to:
> this.qForm.$ queue.validation [this.qForm. $queue.validatio n.length] =
new Array(this.name, fn, "{0}");
Added function (to bottom of file):
// Field removeValidation( [validation | index]) method
Field.prototype. removeValidation = function(v){
var q = this.qForm.$ queue.validation ;
if(typeof v == 'undefined') {
var _q = [];
for(i=0; i<q.length; i++) if(q[i][0]!= this.name) _q.push(q[i] );
this.qForm.$ queue.validation =_q;
}else if(/\d/.test( v)){
var c = 0;
for(i=0; i<q.length; i++) if(q[i][0]== this.name) { if(c==v)
q.splice(i, 1); c++; }
}else{
for(i=0; i<q.length; i++) if(q[i][0]== this.name && new
RegExp("^(is| validate) ?"+q[i][2] +"$",'i') .test(v)) { q.splice(i, 1); }
}
};
I also noticed an update required to removeField( ) that was needed to
remove a field from the qForm object.
File: /qform.js
replaced the current qForm.prototype. removeField method with:
// qForm removeField( sFieldName) method
qForm.prototype. removeField = function (n){
// this function requires a JS1.2 browser
// currently, events attached to a form field are not
// deleted. this means you'll need to manually remove
// the field from the DOM, or errors will occur
var r = this.onRemoveField( n);
if( !r ) return r;
if( _t(this[n], "undefined") ) return false;
delete this[n];
delete this.$pointers[ n.toLowerCase( )];
var f = this._fields;
// find the field in the fields array and remove it
for( var i=0; i < f.length; i++ ){
if( f[i] == n ){
f.splice(i,1) ;
break;
}
}
return true;
};
Anyway, this was something that I needed, and thought someone else might
find useful.
-adam
I recently required the use of a removeValidation() on the fly function
and was unable to find something that would work - so I came up with
something.
file: /lib/api/core.validation.js
Updated (line 115):
> this.qForm.$queue.validation[this.qForm.$queue.validation.length] =
new Array(this.name, fn);
to:
> this.qForm.$queue.validation[this.qForm.$queue.validation.length] =
new Array(this.name, fn, "{0}");
Added function (to bottom of file):
// Field removeValidation([validation | index]) method
Field.prototype.removeValidation = function(v){
var q = this.qForm.$queue.validation;
if(typeof v == 'undefined'){
var _q = [];
for(i=0; i<q.length; i++) if(q[i][0]!=this.name) _q.push(q[i]);
this.qForm.$queue.validation=_q;
}else if(/\d/.test(v)){
var c = 0;
for(i=0; i<q.length; i++) if(q[i][0]==this.name){ if(c==v)
q.splice(i, 1); c++; }
}else{
for(i=0; i<q.length; i++) if(q[i][0]==this.name && new
RegExp("^(is|validate)?"+q[i][2]+"$",'i').test(v)){ q.splice(i, 1); }
}
};
I also noticed an update required to removeField() that was needed to
remove a field from the qForm object.
File: /qform.js
replaced the current qForm.prototype.removeField method with:
// qForm removeField(sFieldName) method
qForm.prototype.removeField = function (n){
// this function requires a JS1.2 browser
// currently, events attached to a form field are not
// deleted. this means you'll need to manually remove
// the field from the DOM, or errors will occur
var r = this.onRemoveField(n);
if( !r ) return r;
if( _t(this[n], "undefined") ) return false;
// remove validation on fields
this.$queue.validation=[];
this.$pointers[n.toLowerCase()].removeValidation();
delete this[n];
delete this.$pointers[n.toLowerCase()];
var f = this._fields;
// find the field in the fields array and remove it
for( var i=0; i < f.length; i++ ){
if( f[i] == n ){
f.splice(i,1);
break;
}
}
return true;
};
Anyway, this was something that I needed, and thought someone else might
find useful.
-adam
Guess one thing I should have asked before I go digging too far, after I run the validate() is there something I can check to see that the validate() prompted the user with an alert?
On Jan 16, 2008 2:10 PM, Aaron Rouse <aaron.rouse@...> wrote:
Dan,
Thanks, I just read it now in the docs and was about to reply to here with a "nevermind"
Aaron
On Jan 16, 2008 2:07 PM, Dan G. Switzer, II <
dswitzer@...> wrote:
Is there a way to trigger the validation on a form without
submitting it? I want to validate information before inserting it into a
hidden table for later use.
Guess one thing I should have asked before I go digging too far, after I run the validate() is there something I can check to see that the validate() prompted the user with an alert?
On Jan 16, 2008 2:10 PM, Aaron Rouse <aaron.rouse@...> wrote:
Dan,
Thanks, I just read it now in the docs and was about to reply to here with a "nevermind"
Aaron
On Jan 16, 2008 2:07 PM, Dan G. Switzer, II <
dswitzer@...> wrote:
Is there a way to trigger the validation on a form without
submitting it? I want to validate information before inserting it into a
hidden table for later use.
Is there a way to trigger the validation on a form without
submitting it? I want to validate information before inserting it into a
hidden table for later use.
From:qformsapi@yahoogroups.com
[mailto:qformsapi@yahoogroups.com] On
Behalf Of Aaron Rouse Sent: Wednesday, January 16, 2008 2:59 PM To:qformsapi@yahoogroups.com Subject: [qformsapi] Trigger Validation
Is there a way to trigger the validation on a form without
submitting it? I want to validate information before inserting it into a
hidden table for later use.
Is there a way to trigger the validation on a form without submitting it? I want to validate information before inserting it into a hidden table for later use.
1 is the same as "True" in javascript. So it sounds like its working as it
should if not as you expected.
Fred T. Sanders
----- Original Message -----
From: "less_than_kind" <hkinash@...>
To: <qformsapi@yahoogroups.com>
Sent: Thursday, January 03, 2008 1:45 PM
Subject: [qformsapi] Re: confused on dependencies
> It seems to be creating the dependency regardless of the value of
> needEmail - I can check the value using getValue() and it says the
> value is 1, but it is returning true on createDependencyTo, and then
> executing validateEmail().
>
> --- In qformsapi@yahoogroups.com, Edward A Savage Jr <sonnysavage@...>
> wrote:
>>
>>
>> Based on the documentation
>
(http://www.pengoworks.com/qforms/docs/extension_fields.htm#createDependencyTo)
> I'd have to disagree with Dean.
>>
>> The JavaScript should look something like this:
>>
>> objForm.emailAddress.createDependencyTo("FaxMe",
> "objForm.needEmail.getValue() = '0'");
>> Edward "Sonny" Savage
>> http://savagefamily.pbwiki.com/
>>
>>
>> ----- Original Message ----
>> From: Dean Lawrence <deanlaw@...>
>> To: qformsapi@yahoogroups.com
>> Sent: Wednesday, January 2, 2008 2:43:21 PM
>> Subject: Re: [qformsapi] confused on dependencies
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> The createDependencyTo would not work in this situation
> since
>>
>> selecting either of the Yes/No needEmail radio buttons would cause the
>>
>> emailAddress field to be required. What you could do is to make the
>>
>> submit button a type="button" instead of type="submit" and then attach
>>
>> an event to the onclick which evaluates the needEmail value and then
>>
>> either sets or unsets (is that a word?) the required value of the
>>
>> emailAddress field and then submits the form. It would look something
>>
>> like this.
>>
>>
>>
>> objForm.btnSubmit. addEvent( "onclick" , "checkemail( );", false);
>>
>>
>>
>> function checkemail() {
>>
>> var requireEmail= objForm.emailAdd ress.getValue( );
>>
>> if (requireEmail) {
>>
>> objForm.emailAddres s.required = true;
>>
>> objForm.submit( );
>>
>> return true ;
>>
>> }else {
>>
>> objForm.emailAddres s.required = false;
>>
>> return false ;
>>
>> }
>>
>> }
>>
>>
>>
>> Hope this helps,
>>
>>
>>
>> Dean
>>
>>
>>
>> On Jan 2, 2008 11:46 AM, less_than_kind <hkinash@sasktel. net> wrote:
>>
>> > Right now what I'm trying to accomplish is to only validate a certain
>>
>> > field - let's call it emailAddress - if a certain radio button is
>>
>> > selected. Let's call the radio buttons needEmail, and there are two -
>>
>> > one with a value of 1, and another with a value of 0. I only want the
>>
>> > field emailAddress validated if needEmail = 0.
>>
>> >
>>
>> > I don't know if using createDependencyTo would work even if it played
>>
>> > nice with the radio buttons - I haven't found an example that shows
>>
>> > what I'm trying to do. If emailAddress was set to not required, but
>>
>> > validateEmail( ) was still used on it, wouldn't it throw an error?
>>
>> >
>>
>> > Thanks for any help. :)
>>
>> >
>>
>> >
>>
>> >
>>
>> >
>>
>> > Yahoo! Groups Links
>>
>> >
>>
>> >
>>
>> >
>>
>> >
>>
>>
>>
>> --
>>
>> ____________ _________ _________ _________ ___
>>
>> Dean Lawrence, CIO/Partner
>>
>> Internet Data Technology
>>
>> 888.GET.IDT1 ext. 701 * fax: 888.438.4381
>>
>> http://www.idatatec h.com/
>>
>> Corporate Internet Development and Marketing Specialists
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> <!--
>>
>>
>>
>> #ygrp-mkp{
>> border:1px solid #d8d8d8;font-family:Arial;margin:14px
> 0px;padding:0px 14px;}
>> #ygrp-mkp hr{
>> border:1px solid #d8d8d8;}
>> #ygrp-mkp #hd{
>>
> color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px
> 0px;}
>> #ygrp-mkp #ads{
>> margin-bottom:10px;}
>> #ygrp-mkp .ad{
>> padding:0 0;}
>> #ygrp-mkp .ad a{
>> color:#0000ff;text-decoration:none;}
>> -->
>>
>>
>>
>> <!--
>>
>>
>>
>> #ygrp-sponsor #ygrp-lc{
>> font-family:Arial;}
>> #ygrp-sponsor #ygrp-lc #hd{
>> margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
>> #ygrp-sponsor #ygrp-lc .ad{
>> margin-bottom:10px;padding:0 0;}
>> -->
>>
>>
>>
>> <!--
>>
>>
>>
>> #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean,
> sans-serif;}
>> #ygrp-mlmsg table {font-size:inherit;font:100%;}
>> #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica,
> clean, sans-serif;}
>> #ygrp-mlmsg pre, code {font:115% monospace;}
>> #ygrp-mlmsg * {line-height:1.22em;}
>> #ygrp-text{
>> font-family:Georgia;}
>> #ygrp-text p{
>> margin:0 0 1em 0;}
>> #ygrp-tpmsgs{
>> font-family:Arial;clear:both;}
>> #ygrp-vitnav{
>> padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
>> #ygrp-vitnav a{
>> padding:0 1px;}
>> #ygrp-actbar{
>> clear:both;margin:25px
> 0;white-space:nowrap;color:#666;text-align:right;}
>> #ygrp-actbar .left{
>> float:left;white-space:nowrap;}
>> .bld{font-weight:bold;}
>> #ygrp-grft{
>> font-family:Verdana;font-size:77%;padding:15px 0;}
>> #ygrp-ft{
>> font-family:verdana;font-size:77%;border-top:1px solid
> #666;padding:5px 0;}
>> #ygrp-mlmsg #logo{
>> padding-bottom:10px;}
>>
>> #ygrp-vital{
>> background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
>> #ygrp-vital #vithd{
>>
>
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:upp\
ercase;}
>> #ygrp-vital ul{
>> padding:0;margin:2px 0;}
>> #ygrp-vital ul li{
>> list-style-type:none;clear:both;border:1px solid #e0ecee;}
>> #ygrp-vital ul li .ct{
>>
>
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-ri\
ght:.5em;}
>> #ygrp-vital ul li .cat{
>> font-weight:bold;}
>> #ygrp-vital a{
>> text-decoration:none;}
>>
>> #ygrp-vital a:hover{
>> text-decoration:underline;}
>>
>> #ygrp-sponsor #hd{
>> color:#999;font-size:77%;}
>> #ygrp-sponsor #ov{
>> padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
>> #ygrp-sponsor #ov ul{
>> padding:0 0 0 8px;margin:0;}
>> #ygrp-sponsor #ov li{
>> list-style-type:square;padding:6px 0;font-size:77%;}
>> #ygrp-sponsor #ov li a{
>> text-decoration:none;font-size:130%;}
>> #ygrp-sponsor #nc{
>> background-color:#eee;margin-bottom:20px;padding:0 8px;}
>> #ygrp-sponsor .ad{
>> padding:8px 0;}
>> #ygrp-sponsor .ad #hd1{
>>
>
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%\
;}
>> #ygrp-sponsor .ad a{
>> text-decoration:none;}
>> #ygrp-sponsor .ad a:hover{
>> text-decoration:underline;}
>> #ygrp-sponsor .ad p{
>> margin:0;}
>> o{font-size:0;}
>> .MsoNormal{
>> margin:0 0 0 0;}
>> #ygrp-text tt{
>> font-size:120%;}
>> blockquote{margin:0 0 0 4px;}
>> .replbq{margin:4;}
>> -->
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
________________________________________________________________________________\
____
>> Be a better friend, newshound, and
>> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
It seems to be creating the dependency regardless of the value of
needEmail - I can check the value using getValue() and it says the
value is 1, but it is returning true on createDependencyTo, and then
executing validateEmail().
--- In qformsapi@yahoogroups.com, Edward A Savage Jr <sonnysavage@...>
wrote:
>
>
> Based on the documentation
(http://www.pengoworks.com/qforms/docs/extension_fields.htm#createDependencyTo)
I'd have to disagree with Dean.
>
> The JavaScript should look something like this:
>
> objForm.emailAddress.createDependencyTo("FaxMe",
"objForm.needEmail.getValue() = '0'");
> Edward "Sonny" Savage
> http://savagefamily.pbwiki.com/
>
>
> ----- Original Message ----
> From: Dean Lawrence <deanlaw@...>
> To: qformsapi@yahoogroups.com
> Sent: Wednesday, January 2, 2008 2:43:21 PM
> Subject: Re: [qformsapi] confused on dependencies
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> The createDependencyTo would not work in this situation
since
>
> selecting either of the Yes/No needEmail radio buttons would cause the
>
> emailAddress field to be required. What you could do is to make the
>
> submit button a type="button" instead of type="submit" and then attach
>
> an event to the onclick which evaluates the needEmail value and then
>
> either sets or unsets (is that a word?) the required value of the
>
> emailAddress field and then submits the form. It would look something
>
> like this.
>
>
>
> objForm.btnSubmit. addEvent( "onclick" , "checkemail( );", false);
>
>
>
> function checkemail() {
>
> var requireEmail= objForm.emailAdd ress.getValue( );
>
> if (requireEmail) {
>
> objForm.emailAddres s.required = true;
>
> objForm.submit( );
>
> return true ;
>
> }else {
>
> objForm.emailAddres s.required = false;
>
> return false ;
>
> }
>
> }
>
>
>
> Hope this helps,
>
>
>
> Dean
>
>
>
> On Jan 2, 2008 11:46 AM, less_than_kind <hkinash@sasktel. net> wrote:
>
> > Right now what I'm trying to accomplish is to only validate a certain
>
> > field - let's call it emailAddress - if a certain radio button is
>
> > selected. Let's call the radio buttons needEmail, and there are two -
>
> > one with a value of 1, and another with a value of 0. I only want the
>
> > field emailAddress validated if needEmail = 0.
>
> >
>
> > I don't know if using createDependencyTo would work even if it played
>
> > nice with the radio buttons - I haven't found an example that shows
>
> > what I'm trying to do. If emailAddress was set to not required, but
>
> > validateEmail( ) was still used on it, wouldn't it throw an error?
>
> >
>
> > Thanks for any help. :)
>
> >
>
> >
>
> >
>
> >
>
> > Yahoo! Groups Links
>
> >
>
> >
>
> >
>
> >
>
>
>
> --
>
> ____________ _________ _________ _________ ___
>
> Dean Lawrence, CIO/Partner
>
> Internet Data Technology
>
> 888.GET.IDT1 ext. 701 * fax: 888.438.4381
>
> http://www.idatatec h.com/
>
> Corporate Internet Development and Marketing Specialists
>
>
>
>
>
>
>
>
>
>
>
>
> <!--
>
>
>
> #ygrp-mkp{
> border:1px solid #d8d8d8;font-family:Arial;margin:14px
0px;padding:0px 14px;}
> #ygrp-mkp hr{
> border:1px solid #d8d8d8;}
> #ygrp-mkp #hd{
>
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px
0px;}
> #ygrp-mkp #ads{
> margin-bottom:10px;}
> #ygrp-mkp .ad{
> padding:0 0;}
> #ygrp-mkp .ad a{
> color:#0000ff;text-decoration:none;}
> -->
>
>
>
> <!--
>
>
>
> #ygrp-sponsor #ygrp-lc{
> font-family:Arial;}
> #ygrp-sponsor #ygrp-lc #hd{
> margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
> #ygrp-sponsor #ygrp-lc .ad{
> margin-bottom:10px;padding:0 0;}
> -->
>
>
>
> <!--
>
>
>
> #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean,
sans-serif;}
> #ygrp-mlmsg table {font-size:inherit;font:100%;}
> #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica,
clean, sans-serif;}
> #ygrp-mlmsg pre, code {font:115% monospace;}
> #ygrp-mlmsg * {line-height:1.22em;}
> #ygrp-text{
> font-family:Georgia;}
> #ygrp-text p{
> margin:0 0 1em 0;}
> #ygrp-tpmsgs{
> font-family:Arial;clear:both;}
> #ygrp-vitnav{
> padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
> #ygrp-vitnav a{
> padding:0 1px;}
> #ygrp-actbar{
> clear:both;margin:25px
0;white-space:nowrap;color:#666;text-align:right;}
> #ygrp-actbar .left{
> float:left;white-space:nowrap;}
> .bld{font-weight:bold;}
> #ygrp-grft{
> font-family:Verdana;font-size:77%;padding:15px 0;}
> #ygrp-ft{
> font-family:verdana;font-size:77%;border-top:1px solid
#666;padding:5px 0;}
> #ygrp-mlmsg #logo{
> padding-bottom:10px;}
>
> #ygrp-vital{
> background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
> #ygrp-vital #vithd{
>
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:upp\
ercase;}
> #ygrp-vital ul{
> padding:0;margin:2px 0;}
> #ygrp-vital ul li{
> list-style-type:none;clear:both;border:1px solid #e0ecee;}
> #ygrp-vital ul li .ct{
>
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-ri\
ght:.5em;}
> #ygrp-vital ul li .cat{
> font-weight:bold;}
> #ygrp-vital a{
> text-decoration:none;}
>
> #ygrp-vital a:hover{
> text-decoration:underline;}
>
> #ygrp-sponsor #hd{
> color:#999;font-size:77%;}
> #ygrp-sponsor #ov{
> padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
> #ygrp-sponsor #ov ul{
> padding:0 0 0 8px;margin:0;}
> #ygrp-sponsor #ov li{
> list-style-type:square;padding:6px 0;font-size:77%;}
> #ygrp-sponsor #ov li a{
> text-decoration:none;font-size:130%;}
> #ygrp-sponsor #nc{
> background-color:#eee;margin-bottom:20px;padding:0 8px;}
> #ygrp-sponsor .ad{
> padding:8px 0;}
> #ygrp-sponsor .ad #hd1{
>
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%\
;}
> #ygrp-sponsor .ad a{
> text-decoration:none;}
> #ygrp-sponsor .ad a:hover{
> text-decoration:underline;}
> #ygrp-sponsor .ad p{
> margin:0;}
> o{font-size:0;}
> .MsoNormal{
> margin:0 0 0 0;}
> #ygrp-text tt{
> font-size:120%;}
> blockquote{margin:0 0 0 4px;}
> .replbq{margin:4;}
> -->
>
>
>
>
>
>
>
>
>
>
________________________________________________________________________________\
____
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
Edward,
You are indeed correct. That's what I get for trying to go off memory.
Thanks for setting it straight. 8-)
Dean
On Jan 2, 2008 8:03 PM, Edward A Savage Jr <sonnysavage@...> wrote:
>
> Based on the documentation
>
(http://www.pengoworks.com/qforms/docs/extension_fields.htm#createDependencyTo)
> I'd have to disagree with Dean.
>
> The JavaScript should look something like this:
> objForm.emailAddress.createDependencyTo("FaxMe",
> "objForm.needEmail.getValue() = '0'");
> Edward "Sonny" Savage
> http://savagefamily.pbwiki.com/
>
>
>
> ----- Original Message ----
> From: Dean Lawrence <deanlaw@...>
> To: qformsapi@yahoogroups.com
> Sent: Wednesday, January 2, 2008 2:43:21 PM
> Subject: Re: [qformsapi] confused on dependencies
>
>
>
> The createDependencyTo would not work in this situation since
> selecting either of the Yes/No needEmail radio buttons would cause the
> emailAddress field to be required. What you could do is to make the
> submit button a type="button" instead of type="submit" and then attach
> an event to the onclick which evaluates the needEmail value and then
> either sets or unsets (is that a word?) the required value of the
> emailAddress field and then submits the form. It would look something
> like this.
>
> objForm.btnSubmit. addEvent( "onclick" , "checkemail( );", false);
>
> function checkemail() {
> var requireEmail= objForm.emailAdd ress.getValue( );
> if (requireEmail) {
> objForm.emailAddres s.required = true;
>
> objForm.submit( );
> return true ;
> }else {
> objForm.emailAddres s.required = false;
>
> return false ;
> }
> }
>
> Hope this helps,
>
> Dean
>
> On Jan 2, 2008 11:46 AM, less_than_kind <hkinash@sasktel. net> wrote:
> > Right now what I'm trying to accomplish is to only validate a certain
> > field - let's call it emailAddress - if a certain radio button is
> > selected. Let's call the radio buttons needEmail, and there are two -
> > one with a value of 1, and another with a value of 0. I only want the
> > field emailAddress validated if needEmail = 0.
> >
> > I don't know if using createDependencyTo would work even if it played
> > nice with the radio buttons - I haven't found an example that shows
> > what I'm trying to do. If emailAddress was set to not required, but
> > validateEmail( ) was still used on it, wouldn't it throw an error?
> >
> > Thanks for any help. :)
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
> --
> ____________ _________ _________ _________ ___
>
> Dean Lawrence, CIO/Partner
> Internet Data Technology
> 888.GET.IDT1 ext. 701 * fax: 888.438.4381
> http://www.idatatec h.com/
>
> Corporate Internet Development and Marketing Specialists
>
>
>
>
>
> ________________________________
> Never miss a thing. Make Yahoo your homepage.
--
__________________________________________
Dean Lawrence, CIO/Partner
Internet Data Technology
888.GET.IDT1 ext. 701 * fax: 888.438.4381
http://www.idatatech.com/
Corporate Internet Development and Marketing Specialists
----- Original Message ---- From: Dean Lawrence <deanlaw@...> To: qformsapi@yahoogroups.com Sent: Wednesday, January 2, 2008 2:43:21 PM Subject: Re: [qformsapi] confused on dependencies
The createDependencyTo would not work in this situation since
selecting either of the Yes/No needEmail radio buttons would cause the
emailAddress field to be required. What you could do is to make the
submit button a type="button" instead of type="submit" and then attach
an event to the onclick which evaluates the needEmail value and then
either sets or unsets (is that a word?) the required value of the
emailAddress field and then submits the form. It would look something
like this.
On Jan 2, 2008 11:46 AM, less_than_kind <hkinash@sasktel. net> wrote:
> Right now what I'm trying to accomplish is to only validate a certain
> field - let's call it emailAddress - if a certain radio button is
> selected. Let's call the radio buttons needEmail, and there are two -
> one with a value of 1, and another with a value of 0. I only want the
> field emailAddress validated if needEmail = 0.
>
> I don't know if using createDependencyTo would work even if it played
> nice with the radio buttons - I haven't found an example that shows
> what I'm trying to do. If emailAddress was set to not required, but
> validateEmail( ) was still used on it, wouldn't it throw an error?
>
> Thanks for any help. :)
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
--
____________ _________ _________ _________ ___
Dean Lawrence, CIO/Partner
Internet Data Technology
888.GET.IDT1 ext. 701 * fax: 888.438.4381 http://www.idatatec h.com/
Corporate Internet Development and Marketing Specialists
The createDependencyTo would not work in this situation since
selecting either of the Yes/No needEmail radio buttons would cause the
emailAddress field to be required. What you could do is to make the
submit button a type="button" instead of type="submit" and then attach
an event to the onclick which evaluates the needEmail value and then
either sets or unsets (is that a word?) the required value of the
emailAddress field and then submits the form. It would look something
like this.
objForm.btnSubmit.addEvent("onclick", "checkemail();", false);
function checkemail() {
var requireEmail=objForm.emailAddress.getValue();
if (requireEmail){
objForm.emailAddress.required = true;
objForm.submit();
return true ;
}else {
objForm.emailAddress.required = false;
return false ;
}
}
Hope this helps,
Dean
On Jan 2, 2008 11:46 AM, less_than_kind <hkinash@...> wrote:
> Right now what I'm trying to accomplish is to only validate a certain
> field - let's call it emailAddress - if a certain radio button is
> selected. Let's call the radio buttons needEmail, and there are two -
> one with a value of 1, and another with a value of 0. I only want the
> field emailAddress validated if needEmail = 0.
>
> I don't know if using createDependencyTo would work even if it played
> nice with the radio buttons - I haven't found an example that shows
> what I'm trying to do. If emailAddress was set to not required, but
> validateEmail() was still used on it, wouldn't it throw an error?
>
> Thanks for any help. :)
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
--
__________________________________________
Dean Lawrence, CIO/Partner
Internet Data Technology
888.GET.IDT1 ext. 701 * fax: 888.438.4381
http://www.idatatech.com/
Corporate Internet Development and Marketing Specialists
According to what I've experienced the validateEmail() should only throw an error if there was a value entered and it is not a valid email address. Making it required forces you to place a value in the field. The follow up or secondary action would be the validation of the email address.
The create dependency function allows you to tie two fields together. Once the the first field is acted upon then the other field becomes required..
Hope this helps.
Sincerely,
Craig
----- Original Message ---- From: less_than_kind <hkinash@...> To: qformsapi@yahoogroups.com Sent: Wednesday, January 2, 2008 8:46:56 AM Subject: [qformsapi] confused on dependencies
Right now what I'm trying to accomplish is to only validate a certain field - let's call it emailAddress - if a certain radio button is selected. Let's call the radio buttons needEmail, and there are two - one with a value of 1, and another with a value of 0. I only want the field emailAddress validated if needEmail = 0.
I don't know if using createDependencyTo would work even if it played nice with the radio buttons - I haven't found an example that shows what I'm trying to do. If emailAddress was set to not required, but validateEmail( ) was still used on it, wouldn't it throw an error?
Thanks for any help. :)
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Right now what I'm trying to accomplish is to only validate a certain
field - let's call it emailAddress - if a certain radio button is
selected. Let's call the radio buttons needEmail, and there are two -
one with a value of 1, and another with a value of 0. I only want the
field emailAddress validated if needEmail = 0.
I don't know if using createDependencyTo would work even if it played
nice with the radio buttons - I haven't found an example that shows
what I'm trying to do. If emailAddress was set to not required, but
validateEmail() was still used on it, wouldn't it throw an error?
Thanks for any help. :)
----- Original Message ---- From: Aaron Rouse <
aaron.rouse@...> To: qformsapi@yahoogroups.com Sent: Wednesday, December 5, 2007 3:31:08 PM Subject: [qformsapi] Validate dynamically added fields
I am going to need to have a page that will allow the user to add rows for input. Each row will have the same form fields but their names will increment by one so they have unique names. I'd like to use qForms to validate some of the information in those and was curious if there is a way to I guess inject the new validation rules(what is created, descriptions, dependencies, etc) or if I have to re-initialize qForms each time a row is added or I suppose maybe I could initialize qForms only once a user has clicked on a button to submit the form?
----- Original Message ---- From: Aaron Rouse <aaron.rouse@...> To: qformsapi@yahoogroups.com Sent: Wednesday, December 5, 2007 3:31:08 PM Subject: [qformsapi] Validate dynamically added fields
I am going to need to have a page that will allow the user to add rows for input. Each row will have the same form fields but their names will increment by one so they have unique names. I'd like to use qForms to validate some of the information in those and was curious if there is a way to I guess inject the new validation rules(what is created, descriptions, dependencies, etc) or if I have to re-initialize qForms each time a row is added or I suppose maybe I could initialize qForms only once a user has clicked on a button to submit the form?
I am going to need to have a page that will allow the user to add rows for input. Each row will have the same form fields but their names will increment by one so they have unique names. I'd like to use qForms to validate some of the information in those and was curious if there is a way to I guess inject the new validation rules(what is created, descriptions, dependencies, etc) or if I have to re-initialize qForms each time a row is added or I suppose maybe I could initialize qForms only once a user has clicked on a button to submit the form?
The _sic() function of the Function library has a bug in the "numeric"
case. I believe the RegExp("\\d+", "gi") should be RegExp("[^0-9]+",
"gi") because it is supposed to remove the non-numeric characters –
not the numeric ones. I hope this helps.
-adam
Hi Dan,
Thanks for stepping in. Yes, I'm aware of the serialize method, and
since I'm using CF on the back end, reading the WDDX string is simple
enough.
However, in this particular case, I have a very long form on multiple
tabs which, after much travail, was finally finished, including all
the server-side routines, with the form fields flowing into a
Model-Glue event, then into Transfer objects.
Then a change was made, which essentially requires that I place an
AJAX form/routine in the middle of my main form, requiring that I
split the main form. Rather than rewriting the server-side routines,
too -- which wouldn't be that hard, certainly -- I chose to keep the
fields as individual values in the request's normal form scope.
But that's simple enough -- when form 2 is submitted, I just grab the
handy qForms object for form 1, go over the array and create hidden
fields as children of form 2. As I said earlier, I just thought there
might be a built-in way in qForms to do this. I fully understand why
the serialize method is better in most cases.
Thanks again for your help, and for a great tool.
--
Thanks,
Tom
Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560
Tom,
>I had a feeling that's what I was going to hear. I know you can't
>submit both forms. Basically, I was hoping that since the qFormsAPI
>object already contained all the name/value pairs, there might be a
>built-in function in qForms to do the looping and create the hidden
>fields, as you suggest.
>
>Certainly the WDDX structure gives you everything in one place. But
>qForms has so many ways of accessing and using its objects, I thought
>that perhaps the step of outputting the value pairs from the qFormsAPI
>object might already be built -- although I couldn't find it.
In the qforms folder, there's a wddx.js library file. Just include this in
your qFormsAPI.include() calls. You can then do qFormsAPI.serialize() to
serialize all the forms into a WDDX structure--which you can then pass in a
hidden field.
The serialize() method takes a list of field to exclude, and you will want
to exclude the field you plan on storing the WDDX results in.
-Dan