Bug #21920 Version Retired

Modifying an entry by Channel Form throwing a PHP error : Call to a member function head_link()

Version: 2.11.2 Reporter: pixi

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

I have a very simple Channel Form on my page :

{exp:channel:entries channel="accueil" limit="1"}

You are modifying the entry named "{title}":

    {exp:channel:form channel="accueil" entry_id="{entry_id}" require_entry="yes" return="accueil/index" error_handling="inline" show_fields="titre_de_laccueil|texte_de_laccueil|domaines_dexpertise"}
        {custom_fields}
            
            <label for="{field_name}">{field_label}{if required}<span class="required_field_asterisk"> *</span>{/if}</label>
            {field_instructions}
            {formatting_buttons}

            {if error}
                {error}
            {/if}

            {if textarea}
                <textarea id="{field_name}" name="{field_name}" dir="{text_direction}" rows="{rows}">{field_data}</textarea>
            {/if}

            {if text}
                <input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50">
            {/if}

            {if select}
                <select id="{field_name}" name="{field_name}">
                  {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
                </select>
            {/if}

            {if checkbox}
                {options}
                  <label class="checkbox">{option_value}
                    <input type="checkbox" id="{field_name}" name="{field_name}[]" value="{option_value}"{checked}>
                  </label>
                {/options}
            {/if}

            {if grid}
                {display_field}
            {/if}

            {if wygwam}
                {display_field}
            {/if}

            {if field_name=='domaines'}
                {display_field}
            {/if}

            
        {/custom_fields}

  <input type="submit" value="Enregistrer les modifications">
{/exp:channel:form}

{/exp:channel:entries}


I have a very simple Channel Form on my page :

  {exp:channel:entries channel="accueil" limit="1"}
  {exp:channel:form channel="accueil" entry_id="{entry_id}” require_entry=“yes” return=“accueil/index” error_handling=“inline” show_fields=“titre_de_laccueil|texte_de_laccueil|domaines_dexpertise”}
      {custom_fields}
       
        <label for=”{field_name}”>{field_label}{if required} *{/if}</label>
        {field_instructions}
        {formatting_buttons}

        {if error}
          {error}
        {/if}

        {if textarea}
          <textarea id=”{field_name}” name=”{field_name}” dir=”{text_direction}” rows=”{rows}”>{field_data}</textarea>
        {/if}

        {if text}
          <input type=“text” dir=”{text_direction}” id=”{field_name}” name=”{field_name}” value=”{field_data}” maxlength=”{maxlength}” size=“50”>
        {/if}

        {if select}
          <select id=”{field_name}” name=”{field_name}”>
            {options}<option value=”{option_value}”{selected}>{option_name}</option>{/options}
          </select>
        {/if}

        {if checkbox}
          {options}
            <label class=“checkbox”>{option_value}
              <input type=“checkbox” id=”{field_name}” name=”{field_name}[]” value=”{option_value}”{checked}>
            </label>
          {/options}
        {/if}

        {if grid}
          {display_field}
        {/if}

        {if wygwam}
          {display_field}
        {/if}

        {if field_name=='domaines'}
          {display_field}
        {/if}

       
      {/custom_fields}

  <input type=“submit” value=“Enregistrer les modifications”>
{/exp:channel:form}

{/exp:channel:entries}

If I just change the contents of the fields and click on submit—> no problem, it saves the modified entry as intended.

If I empty a required field and click on submit—> I get this error (that prevent the modified entry to be saved) instead of the validation :

A PHP Error was encountered

    Severity: Notice

    Message: Undefined property: EE::$view

    Filename: libraries/File_field.php

    Line Number: 718

    Fatal error: Call to a member function head_link() on a non-object in [...]/system/expressionengine/libraries/File_field.php on line 718

I don’t even have a file field in this channel!

I didn’t find the reason of this…


Some new investigations showed me that if I remove the {if wygwam} {display_field} {/if} (I have a wygwam field in my channel) and empty a required field as explained above, it gives me the right validation message “This field is required” in place of throwing the PHP error…Perhaps this is a clue (latest wygwam version is installed)

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases