Hi all,
This is somewhat related to my previous post here http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=89678 . Since it's an old post, I decided to create a new one.
Changing the required field depending on user selection is currently working. The problem that I am currently having is that if I try to pass a query string on the URL (<!-- w --><a class="postlink" href="http://www.domain.org/contact?formid=300">www.domain.org/contact?formid=300</a><!-- w -->) and change the required field based on the value of the query string, it doesn't work. To be more specific using the code
works properly if it's called by a change event triggered by the user, but produce an error if called by onload event (if it's within the window.addEvent('domready', function() {....) here's the error that i'm getting
Uncaught ReferenceError: formCheck_ContactUs is not defined contact?formid=300:1576
makeRequired contact?formid=300:1576
preSelected contact?formid=300:515
(anonymous function) contact?formid=300:95
(anonymous function) mootools-core.js:375
(anonymous function) mootools-core.js:33
Array.implement.each mootools-core.js:40
invoke.fireEvent mootools-core.js:374
g mootools-core.js:514
Thanks in advance for the help.
J2.5 CFv4.0 RC3.5.2
This is somewhat related to my previous post here http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=89678 . Since it's an old post, I decided to create a new one.
Changing the required field depending on user selection is currently working. The problem that I am currently having is that if I try to pass a query string on the URL (<!-- w --><a class="postlink" href="http://www.domain.org/contact?formid=300">www.domain.org/contact?formid=300</a><!-- w -->) and change the required field based on the value of the query string, it doesn't work. To be more specific using the code
function makeRequired(el){
el.addClass(req);
formCheck_ContactUs.register(el);
}
//ContactUs being the form name
works properly if it's called by a change event triggered by the user, but produce an error if called by onload event (if it's within the window.addEvent('domready', function() {....) here's the error that i'm getting
Uncaught ReferenceError: formCheck_ContactUs is not defined contact?formid=300:1576
makeRequired contact?formid=300:1576
preSelected contact?formid=300:515
(anonymous function) contact?formid=300:95
(anonymous function) mootools-core.js:375
(anonymous function) mootools-core.js:33
Array.implement.each mootools-core.js:40
invoke.fireEvent mootools-core.js:374
g mootools-core.js:514
Thanks in advance for the help.
J2.5 CFv4.0 RC3.5.2
Hi WhiteLighter01,
This looks like a problem with the loading sequence in the page; somehow this code is being run before the FormCheck is initialised. You could try switching from 'domready' to 'load' to see if that makes enough of a difference. If not then something else may be needed to get the sequence right. It is certainly possible to do this.
Bob
This looks like a problem with the loading sequence in the page; somehow this code is being run before the FormCheck is initialised. You could try switching from 'domready' to 'load' to see if that makes enough of a difference. If not then something else may be needed to get the sequence right. It is certainly possible to do this.
Bob
Hi GreyHead,
Thanks for the fast reply. Changing the 'domready' to 'load' did the trick. There's one more thing that I'm not sure how to fix, but it's somewhat a minor thing. When a user selected mail publication, I set the address to be the required field (which is working just fine). But if they change their mind and change to email publication, the address field becomes optional and the email field becomes required. The problem that I am having is that, if they tab through the fields, a call-out/bubble/popup message still appears on the address field if they left it blank. This is somewhat minor since they are still able to submit the form even if they left the address field blank (and just ignore the required field bubble/popup). I'm using the following functions to make the fields required/optional
Thanks
Thanks for the fast reply. Changing the 'domready' to 'load' did the trick. There's one more thing that I'm not sure how to fix, but it's somewhat a minor thing. When a user selected mail publication, I set the address to be the required field (which is working just fine). But if they change their mind and change to email publication, the address field becomes optional and the email field becomes required. The problem that I am having is that, if they tab through the fields, a call-out/bubble/popup message still appears on the address field if they left it blank. This is somewhat minor since they are still able to submit the form even if they left the address field blank (and just ignore the required field bubble/popup). I'm using the following functions to make the fields required/optional
function makeRequired(el){
el.addClass(req);
formCheck_ContactUs.register(el);
}
function makeOptional(el){
el.setProperty('class', '');
formCheck_ContactUs.removeError(el);
formCheck_ContactUs.dispose(el);
}
Thanks
Hi WhiteLighter01,
I would expect the code you have there to work OK. I'd need to dig into the FormCheck code to see why those two calls aren't clearing the error completely.
Bob
I would expect the code you have there to work OK. I'd need to dig into the FormCheck code to see why those two calls aren't clearing the error completely.
Bob
Thanks Bob for looking into it. I'll be waiting for the update on this.
Thanks,
Jay
Thanks,
Jay
This topic is locked and no more replies can be posted.