This project has moved. For the latest updates, please go here.

throws error on custom edit form

Sep 28, 2016 at 9:35 AM
Edited Sep 28, 2016 at 9:52 AM
Hello Sir,
I tried to hide and make readonly columns on default newform.aspx, it worked.
But for some reasons I created 2 custom edit forms through designer and tried to make some columns as readonly. But it didn't worked.

It throws error "Unable to get a SPField named Payment"

Where Payment is my column name
Sep 28, 2016 at 3:30 PM
I think this is the expected behavior. SPUtility is meant to be used on the out of box forms. If you are working on custom forms there are other methods to hide or make read only.

To hide a field you set the style of the table row to "display:none". Like this: <tr style="display:none">

To make read only you set the ControlMode of the field to Display. There are two ControlMode settings for each field, make sure you set both. Like this: ControlMode="Display"

I hope this helps.
Sep 29, 2016 at 5:02 AM
Hi Josh,
Thanks for the response. I changed the control mode to make columns as readonly.