Display the contents of a form field as readonly

the_fitz 31 Jul, 2012
Hi all,

I have a profile form in CF4, it works!!!
But I want the username field to be readonly.

in html it would be like....

<input type="text" name="uname" value="<?php echo "$uname"; ?>" size="30" readonly="readonly" />



I tried putting that code into a "Custom Element" and it works but there is no ability for it to have "instructions for users" or "tooltips" to alert the user that it cannot be changed.

How would I address this?

Thanks in advance.

MrFitz
GreyHead 01 Aug, 2012
Hi MrFitz,

If it's read-only why do you need tooltips or user help?? just curious.

You can make it read-only using JavaScript. Add an id=uname to the input then

window.addEvent('domready', function() {
$('uname').setProperty('readonly', 'readonly');
});


Bob
the_fitz 01 Aug, 2012
Hi Bob,
And thanks...

I wanted the user to know that the USERNAME field was "Not Changeable".

It never dawned on me to use the DOM for this. Thanks for the insight.

MrFitz
This topic is locked and no more replies can be posted.