DevHeads.net

Limiting editing of a field after it has been filled

Hello,

I want to configure a node form in that after filling a filed and saving,
the fields cannot be edited, but empty fields can be edited. Is this
possible?

James

Comments

Re: Limiting editing of a field after it has been fill

By William Smith at 05/04/2010 - 09:14

Should be. Are you already comfortable with working with the forms API?
You could test for a value (if !empty) and set #disabled = TRUE for the form
element if there is an existing value.

Re: Limiting editing of a field after it has been fill

By Mutuku Ndeti at 05/04/2010 - 09:31

I am not yet comfortable...but thanks for pointing me in that direction. Let
me get myself comfortable

Re: Limiting editing of a field after it has been fill

By Mutuku Ndeti at 05/08/2010 - 03:17

Allow me to ask a "dummy" question.. just gone through the form API
documentation and some tutorials. Where do I put my faorm api code? on the
themes template.php?

Re: Limiting editing of a field after it has been fill

By William Smith at 05/08/2010 - 06:54

You will want to build a small custom module to house your forms api code.

This requires nothing more than creating a .module file and a .info file.
For the .info file, you could just copy one from a module that you already
have installed, rename it, and edit it. For the .module file, you don't
need anything in it but your form_alter code

Best,
William