Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,506 members, 7,819,836 topics. Date: Tuesday, 07 May 2024 at 02:06 AM

Check Out My Php Code - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Check Out My Php Code (1559 Views)

How Do I Upgrade My Php Version From 5.2.3 To 5.2.4 Or Higher / Php Code For Search Bar / How To Market My PHP And MySQL Skills (2) (3) (4)

(1) (Reply) (Go Down)

Check Out My Php Code by lanbaba: 2:16pm On Sep 10, 2010
Hello,
below is the code textfield in php.
what can i add to the field to make it non editable by my users.
Thanks in anticipation



$form['cpanel_add_email_section']['email_quota'] = array(
'#type' => 'textfield',
'#title' => t('Email Quota'),
'#default_value' => '20',
'#size' => 60,
'#maxlength' => 64,
'#description' => t('Please enter the email account quota (default 20mb)'),
'#required' => TRUE,
);
Re: Check Out My Php Code by DualCore1: 2:24pm On Sep 10, 2010
try

#readonly => TRUE

i have never tried it this way so no guarantee it will work.

Adding "readonly" to a textfield declaration in html makes it unedittable.

<input type="text" class="textfield" readonly/>
Re: Check Out My Php Code by lanbaba: 3:00pm On Sep 10, 2010
it didnt work dual.

the field still remains editable.

Any other solution
Re: Check Out My Php Code by Nobody: 4:06pm On Sep 10, 2010
<input type="text" value="whatever" disabled="disabled">

If you are trying to work around something maybe from a DB or so, just register a value as a variable and echo it like

<input type="text" value="$myValue" disabled="disabled">

That must work if it does not, a Javascript solution will be provided. But note that if Javascript is disabled, the value may be editable!
Re: Check Out My Php Code by Nobody: 10:08pm On Sep 11, 2010
it's a lose lose situation if u make the field disabled that's fine but firebug users can get make it editable, or use used layer a relative div in-front of it make the input an absolute div with negative Z-indexing but they can get away with it by disabling styles in the browser flash is the only way not to get it editable but that be overkill just for that sake my advice just leave it open and make sure code doesn't use that value
Re: Check Out My Php Code by Nobody: 11:07pm On Sep 11, 2010
Come PC Guru, Wetin u dey yan so, pass my understanding,

Read what you wrote, ad modify so i can understand and learn

By the way, shey you won end design of site with that site in your signature, It creatively great.
Re: Check Out My Php Code by Nobody: 10:16am On Sep 12, 2010
this is a simple drupal form api application, sorry guys that i ave been away for awhile

$form['cpanel_add_email_section']['email_quota'] = array(
'#type' => 'textfield',
'#title' => t('Email Quota'),
'#default_value' => '20',
'#size' => 60,
'#readonly' => 'readonly',
'#maxlength' => 64,
'#description' => t('Please enter the email account quota (default 20mb)'),
'#required' => TRUE,
)

dual core was almost correct, the fact is that, even in html the correct syntax is:

<input type="text" class="textfield" readonly="readonly"/>
Re: Check Out My Php Code by DualCore1: 12:41pm On Sep 12, 2010
^^ thanks for the correction.

(1) (Reply)

Vx0 Hosting - Free Cpanel Hosting / Can I Get A Godaddy Domain Name With Firstbank Verve Or Mastercard? / Help A Blogger .pls Very Urgent

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.