Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Prechecked fields in Login Page

Prechecked fields in Login Page

Locked

Views: 2,042

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
10 Apr 2007, 9:16 PM
#1
lindseyb avatar

lindseyb

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Prechecked fields in Login Page

Hey Everyone!

I'm so close to being done, if you have Firefox or Safari please take a look at this link:

https://membership.puppeteers.org/index.php?main_page=login

if you scroll all the way down to the bottom you'll see that the DO NOT boxes are all prechecked.

I have looked at the code, but I can't seem to figure out how to have them default to being unchecked. Here's a snippet of code from my tpl_modules_create_account.php

<?php echo zen_draw_checkbox_field('directoryphone', '1', $directoryphone, 'id="directoryphone-checkbox"') . '<label class="checkboxLabel" for="directoryphone-checkbox">' . ENTRY_DIRECTORYPHONE . '</label>' . (zen_not_null(ENTRY_DIRECTORYPHONE_TEXT) ? '<span class="alert">' . ENTRY_DIRECTORYPHONE_TEXT . '</span>': ''); ?> <br class="clearBoth" />

any thoughts? I'd love some help on this one!
thanks a bunch,
z.

10 Apr 2007, 10:09 PM
#2
tmc_sherpa avatar

tmc_sherpa

Zen Follower

Join Date:
Mar 2007
Posts:
158
Plugin Contributions:
0

Re: Prechecked fields in Login Page

Interesting, removing the checked="checked" using firebug clears the 'on' state from the fax and email lines, but not the phone number line.

anywho, did you clone the Subscribe to Our Newsletter to make the new questions? I'm not sure if its populating the information directly from the page or pulling it out of a database like the default Subscribe does, that will effect where the changes need to be made.

as an aside, it still says copyright zen in the footer, but that is a subject for another post :P

10 Apr 2007, 10:50 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Prechecked fields in Login Page

IF the 3rd paramater is true, then they are checked by default ...

IF the 3rd paramater is false, then they are unchecked by default ...

How are you setting the 3rd paramater of the:

zen_draw_checkbox_field('directoryphone', '1', $directoryphone, 'id="directoryphone-checkbox"')
10 Apr 2007, 11:17 PM
#4
tmc_sherpa avatar

tmc_sherpa

Zen Follower

Join Date:
Mar 2007
Posts:
158
Plugin Contributions:
0

Re: Prechecked fields in Login Page

oh sure, break out the big guns on me :D

10 Apr 2007, 11:51 PM
#5
lindseyb avatar

lindseyb

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Re: Prechecked fields in Login Page

Hi Ajeh,

thanks so much for your advice - I have to admit that I am unsure as to what the 3rd Parameter is...

I have been kind of fumbling through this over the last couple of months, having a very strong knowledge of HTML and learning how to read the PHP as I go. For this instance I copied the newsletter code and then modified it to create what I needed below.

Miraculously it's all getting read by the database and the customer admin successfully :)

Here's a bit more of the code from the section I believe the problem is in below - again it's from the tpl_modules_create_account.php

<?php if (ACCOUNT_NEWSLETTER_STATUS != 0) { ?> <?php echo zen_draw_checkbox_field('newsletter', '1', $newsletter, 'id="newsletter-checkbox"') . '<label class="checkboxLabel" for="newsletter-checkbox">' . ENTRY_NEWSLETTER . '</label>' . (zen_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="alert">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php echo zen_draw_radio_field('playboard', 'ONLINE', ($playboard == 'ONLINE' ? true : false),'id="playboard-online"') . '<label class="radioButtonLabel" for="playboard-online">' . ENTRY_PLAYBOARD_ONLINE_DISPLAY . '</label>' . zen_draw_radio_field('playboard', 'SNAIL', ($playboard == 'SNAIL' ? true : false), 'id="playboard-snail"') . '<label class="radioButtonLabel" for="playboard-snail">' . ENTRY_PLAYBOARD_SNAIL_DISPLAY . '</label>'; ?> <br class="clearBoth" /> <?php echo zen_draw_checkbox_field('directoryphone', '1', $directoryphone, 'id="directoryphone-checkbox"') . '<label class="checkboxLabel" for="directoryphone-checkbox">' . ENTRY_DIRECTORYPHONE . '</label>' . (zen_not_null(ENTRY_DIRECTORYPHONE_TEXT) ? '<span class="alert">' . ENTRY_DIRECTORYPHONE_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php echo zen_draw_checkbox_field('directoryfax', '1', $directoryfax, 'id="directoryfax-checkbox"') . '<label class="checkboxLabel" for="directoryfax-checkbox">' . ENTRY_DIRECTORYFAX . '</label>' . (zen_not_null(ENTRY_DIRECTORYFAX_TEXT) ? '<span class="alert">' . ENTRY_DIRECTORYFAX_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php echo zen_draw_checkbox_field('directoryemail', '1', $directoryemail, 'id="directoryemail-checkbox"') . '<label class="checkboxLabel" for="directoryemail-checkbox">' . ENTRY_DIRECTORYEMAIL . '</label>' . (zen_not_null(ENTRY_DIRECTORYEMAIL_TEXT) ? '<span class="alert">' . ENTRY_DIRECTORYEMAIL_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php } ?>
11 Apr 2007, 1:47 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Prechecked fields in Login Page

If you look at this function:

Line #413 : function zen_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {

The 3rd parameter is what you are passing as $checked ...

In this case you are using:
$directoryphone
$directoryfax
$directoryemail

If those are set to true, then the boxes will be checked ...

If those are set to false, then the boxes will be unchecked ...

Where are you setting the values for those variables and what are the values that you have set them to?

11 Apr 2007, 4:53 AM
#7
lindseyb avatar

lindseyb

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Re: Prechecked fields in Login Page

Hi Ajeh,

I've found the code that you quoted in your reply within the html_output.php files

I've done some searching and as far as I can tell I have not set the values for those three variables. I am unsure exactly what code to write to do that, and where I should put it...

Thanks so much for all your help,
-z.

11 Apr 2007, 5:22 PM
#8
lindseyb avatar

lindseyb

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Re: Prechecked fields in Login Page

Hey Everyone!

I GOT it! I basicallly just replaced $directoryphone with false:

zen_draw_checkbox_field('directoryphone', '1', $directoryphone, 'id="directoryphone-checkbox"') 

zen_draw_checkbox_field('directoryphone', '1', false, 'id="directoryphone-checkbox"')  

Thanks for all your help!
-z.

12 Apr 2007, 1:44 AM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Prechecked fields in Login Page

Glad that you got that fixed and working now ... thanks for the update ... :smile: