Forums / Templates, Stylesheets, Page Layout / How to make an account edit field read-only?

How to make an account edit field read-only?

Started by idc1 on 29 Sep 2011, 7:12 PM · Views: 736

Results 1 to 3 of 3
29 Sep 2011, 7:12 PM
#1
idc1 avatar

idc1

Zen Follower

Join Date:
Jul 2011
Posts:
139
Plugin Contributions:
0

How to make an account edit field read-only?

I'm working in the file

includeds/templates/YOUR_CUSTOM/templates/tpl_account_edit_default.php

I would like to make one of the fields read only. For Example:

<label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>

<?php echo zen_draw_input_field('fax', $account->fields['customers_fax'], 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?> <br class="clearBoth" />

The problems I'm running into are:

  1. zen_draw_hidden_field - causes it not to be visible and updates the file to null

  2. <label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>

<?php echo $account->fields['customers_fax']; ?> <br class="clearBoth" /> ****this portion prevents field from being edited but once you click update, the field gets updated to null******

Please let me know if I can provide any other info that may be useful.

Regards

ZC 1.5.5
Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3

29 Sep 2011, 7:19 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How to make an account edit field read-only?

In the zen_draw_input_field call, change 'id="fax"')to```
'id="fax" readonly="readonly"')


or you might see how using disabled="disabled" affects it instead.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

29 Sep 2011, 7:35 PM
#3
idc1 avatar

idc1

Zen Follower

Join Date:
Jul 2011
Posts:
139
Plugin Contributions:
0

Re: How to make an account edit field read-only?

Many thanks DrByte. I had actually seen this bit of code somewhere in all the searching I had done but ultimately didn't know how to implement such a simple thing.

ZC 1.5.5
Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3