Is css the best way to make a form editable versus non-editable based on permissions?

I have a form.  Based on permissions, it will either be
- readonly;
- partially editable (some fields will remain uneditable);
- fully editable (all fields will be editable)

Is css *the* way to do this, or are there more technical, programmatic ways to do this?  I am inclined to use css but want to make sure that there might not be another way.

Please provide a pseudo-code sample when replying if possible ...

Thanks!
pingdeeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

smaccariCommented:
CSS will enable you to hide/show some of your fields.
If this is what you need, then it is definitely the best way to do this. Use class names to hide of show with display or visibility attributes.
If you do not want to hide them but just disabling them, you will have to add an attribute to the field you do not want to be edited (disabled="true"), either directly in the tag:

<input type="text" disabled="true"/>

or with Javascript:

document.forms["nameOfMyForm"].elements["nameOfFieldToBeDisabled"].disabled = true;
pingdeeAuthor Commented:
This leads me to better clarity - indeed, I do not want to hide fields but simply make them read-only or disabled.  Is disabled the best bet, or is read-only?  
smaccariCommented:
I don't think that read-only is cross browser, but ie only.
disabled is compatible with all browsers.
But you must be aware that a disabled field will not be posted with the form.
So, if you need to get back their values, you would have to use input hidden with the same name containing the same value.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pingdeeAuthor Commented:
thanks, smaccari - i think that i got all i need :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.