my_javascript.js can contain: $(document).ready( $("#clickmebox").click(function () { $('#li–9').toggle(); }); );
finally, turn on cforms datepicker feature *ONLY* if you either require it for date-picker fields or do not have jQuery already loaded (which you do have, so you can turn off the date-picker feature)
give it a shot
Disclaimer: This is all of top off my head and I may have missed a step, let me know if you hit a wall.
The code in my_javascript.js is very basic, but should do the job.
Oliver, thnx for your continued help. I am stuggling.
I have a form with a checkbox field [id:giftaid] and when it is checked I want to change the hidden field [id:desc] to a value of "giftaid"
I have created a js called giftaid.js and its loading in the header.
giftaid.js looks like this:
function afterChecked() { if (document.getElementById('#giftaid').checked == true) { document.getElementById('#desc').value='giftaid' } else { document.getElementById('#desc').value='0' } }
I dont know if this code will find the correct IDs or not.
I dont know if I need to call that script somehow or whether when the checkbox is checked the script will automatically change desc to value "giftaid"
Quazi technical people writing code, never a good idea, or at least that what the developers tell me. :)
I was also wondering why we were hiding fieldset 9 in your instructions, isn't that my checkbox field, or was I meant to create a new field and hide it to do something with the clickmebox?
All help appreciated, apologies for my lack of technical understanding. The problem with running a charity ion the cheap!
Hi Oliver, just getting back to this now after a holiday. Thx for continued help, I'll try this out and let you know how I get on. Appreciate your time.
Yes, the new code toggles the value fine, I checked with firebug. I can't test the form due to captcha field not displaying any text/numbers.
Are you seeing this, too?
Can you make sure to either temporarily remove the captcha field, or ensure that the font files are working fine (they sometimes seem to get corrupted and need to be uploaded manually via ftp).
PS: If you can, I would not use 'name' as the ID for the first field, since this can cause issues if the page is reloaded in non-ajax mode.
Evening Oliver, yup I see it in firebug (didnt think to check using that) and I have posted the form to myself in email and see the description has changed.
I dont see captcha in my browser at all, must be a plugin activation issue! I dont know where its gone. I;m using a mac but dont see why that woud make a difference.
captcha issue a non issue as you describe as I am logged in.
So what I get now is as follows.
When I load the page by navigating to it, the check box is checked and the 'desc' field is empty. if I change the check box it doesnt change in firebug. If I refresh that page and then hit the check box, it changes the desc value to giftaid as expected.
Is there a problem with where the script is loading? The page needs to be refreshed before the script changes the desc field.
I think it failed because the default for the check box was 'checked' yet the thing it was affecting 'desc' needed the default to reflect the 'checked' status.
If you start with checked, the the desc field needs to default to giftaid.