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

How to make an account edit field read-only?

Views: 734

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

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

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

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.
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.