After webform submission restrict/greyout certain fields when user goes back in to edit On my Drupal 7 instance I am letting anonymous users &quot;edit own webform content&quot; or &quot;access own webform results.&quot; The thing is, I want one or two of the fields to become un-editable after the initial submission. Once they click through the link in their confirmation email to edit their submission, I want the email and company name fields to be greyed out but all other fields to be editable. What is my path of least resistance?
From Programmatically modifying a webform with hook_form_alter():
function mymodule_form_alter( &amp;$form, &amp;$form_state,$form_id ){
  global $user;
  if (!$user-&gt;uid &amp;&amp; $form_id == 'MY_WEBFORM_ID') {
    $form['submitted']['MY_FORM_COMPONENT']['#disabled'] = TRUE;
  }
}