Name and machine_name fields not displaying on "add a new app" form and edit form

Not applicable

I have an on premise developer portal with a sub-theme of apigee_responsive. On the /user/me/apps/add page and when editing a developer app, the form renders, but only renders the Callback URL and list of Products and then the Create App button. For the other form fields, it just displays the text "Array".

I've attached an image of the rendered html. We do have a hook_form_alter function in our theme's template.php, but we only modify the form for the user_register_form and user_login_form.

3097-user-apps-add-form-rendered-html.png

0 5 288
5 REPLIES 5

@Jason , Welcome to Apigee Community.

It's very difficult to find out what's the root cause from above HTML. Looks like it's the custom code which is causing above issue. Can you share the form alter code in template.php to understand better ? Have you altered form in any other place like custom module ? Do you see this issue recently ? Did it worked earlier ?

Not applicable

Hi @Anil Sagar, sorry it took a while to respond. Here is my hook_form_alter function in my theme's template.php. I don't think the issue is happening here since we only modify the form based on $form_id. It's most likely from a contrib module we are using. I replaced the name of the theme below with <mysubtheme>.

I was also able to confirm that by changing the theme from my sub-theme to apigee_responsive theme that I wasn't having the issue anymore.

function <mysubtheme>_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    // For registry
    case 'user_register_form':
      // Hidden username
      $form['account']['name']['#access'] = false;


      // Email placeholder handle
      $form['account']['mail']['#attributes']['placeholder'] = $form['account']['mail']['#title'];
      $form['account']['mail']['#title_display'] = "invisible";
      $form['account']['mail']['#description'] = null;


      // Password and confirm password placeholder handle
      $form['account']['pass']['#process'] = array('form_process_password_confirm', 'register_alter_password_confirm');


      // First name placeholder handle
      $form['field_first_name'][LANGUAGE_NONE][0]['value']['#attributes']['placeholder'] = $form['field_first_name']['und']['#title'];
      $form['field_first_name'][LANGUAGE_NONE][0]['value']['#title_display'] = "invisible";


      // Last name placeholder handle
      $form['field_last_name'][LANGUAGE_NONE][0]['value']['#attributes']['placeholder'] = $form['field_last_name']['und']['#title'];
      $form['field_last_name'][LANGUAGE_NONE][0]['value']['#title_display'] = "invisible";


      // Function placeholder handle
      $form['field_user_function'][LANGUAGE_NONE]['#title_display'] = "invisible";
      $form['field_user_function'][LANGUAGE_NONE]['#options']['_none'] = $form['field_user_function']['und']['#title'];


      // Submit name handle
      $form['actions']['submit']['#value'] = t('Submit');
      break;


    // For Login
    case 'user_login_form':
    case 'user_login_block':
    case 'user_login':
      // Display email text in username input and email placeholder handle
      $form['name']['#attributes']['placeholder'] = t('E-mail address');
      $form['name']['#title_display'] = "invisible";
      $form['name']['#description'] = "You may login with your e-mail address.";


      // Password placeholder handle
      $form['pass']['#attributes']['placeholder'] = $form['pass']['#title'];
      $form['pass']['#title_display'] = "invisible";
      $form['remember_me']['#title'] = t('Keep me signed in');


      $form['userpasswordlink']=array('#markup'=>l(t('Forgot your password?'), 'user/password', array('attributes' => array('id' => 'userpasswordlink'))));


      // Submit name handle
      $form['actions']['submit']['#value'] = t('Sign In');
      break;
  }

}

Sorry, I didn't mean to add this as an answer. I'm still having the issue.

@Jason ,

In your above code, break statements are missing for case blocks that might be the reason. Can you update your code with proper break statements / use if conditions. Keep us posted.

Hi @Anil Sagar,

Actually the break statements are in the code above and they work as expected. I actually just found the issue and it is in my theme's hook_preprocess_page function where it looks like we had Apigee add a feature for sticky nav for our theme. Luckily we aren't using this anymore and I can just remove the code. Thanks for the help.

Jason