PDA

View Full Version : Help with onclick to load calendar


Shadow666
02-29-2012, 03:08 AM
Hi,

I am trying to add yes/no radio buttons in the admincp, using the 'function print_yes_no_row'.

How can I get the 'NO' radio button to load the 'function print_time_row' and if the 'YES' radio button is selected to clear the print_time_row.

I have tried using the 'ONCLICK' in the 'function print_yes_no_row', but I can't get it to work.

Hopefully someone can help with this, please.

Thanks.

kh99
02-29-2012, 03:43 AM
You'd need to write some javascript to do that. What you put for onclick has to be javascript code that will run in the user's browser, not a php function.

You could do what you want to do by having javascript to hide and show (or gray out) the time row depending on the state of the radio buttons. I know the notice manager grays out the options that don't have the checkbox checked, so you might look in notice.php to see how that's done.

Shadow666
02-29-2012, 12:16 PM
You'd need to write some javascript to do that. What you put for onclick has to be javascript code that will run in the user's browser, not a php function.

You could do what you want to do by having javascript to hide and show (or gray out) the time row depending on the state of the radio buttons. I know the notice manager grays out the options that don't have the checkbox checked, so you might look in notice.php to see how that's done.

Hi,

I have taken a look at the notice manager, but can't see it graying out anything when I don't have a box ticked.

kh99
02-29-2012, 01:21 PM
Oh, yeah, that's probably because it only does it for certain browsers. But the code is in admincp/notice.php, around line 519 there's a comment that says "javascript to handle disabling elements for IE niceness" (I suppose it was written years ago and hasn't changed).

Shadow666
03-01-2012, 01:13 AM
Thank you.