Form module error

edited March 2018 in Modules
I am trying the Forms module for the 1st time, and having located the 'parser_allowed_functions' config array in MY_Fuel.php (incidentally, the module docs refer to editing the parser config file instead of this) and adding the 'form' function, I can render a form OK via the WYSIWYG, but with a lot of
A PHP Error was encountered Severity: Notice Message: Array to string conversion Filename: libraries/Fuel_forms.php Line Number: 1771 ...
errors. I'm using Fuel v1.4, under PHP 7.

Comments

  • edited 10:37AM
    What does line 1771 look like for you in Fuel_forms.php? Do you have the latest version of it by chance?
  • edited March 2018
    Line 1771 is
    return is_true_val($this->$found[1]);

    It's the master branch from Github, from last week.
  • edited March 2018
    What seems to be happening is that some $found[1] values, whilst strings, do not evaluate as string properties of Fuel_forms class? eg one value that trips the error is 'javascript_submit'. Could the value $this->javascript_submit itself be an array? I'm not sure if that is a dynamically created property?
  • edited March 2018
    That line should be:
    return !empty($this->{$found[1]});
    It's in the develop branch. I've merged it into the master.
  • edited 10:37AM
    That works for me, thanks!
  • edited March 2018
    Could the module documentation be updated to refer to the proper config file? I ran into this same problem (creating and editing the wrong config file) today.
  • edited 10:37AM
    Sure thing... I've updated it.
  • edited June 2018

    I had this working back in March, but now I've come back to it there are issues! When I submit a form (which renders OK) all I get now is a page with nothing but a script tag

    /fuel/modules/fuel/assets/js/jquery/plugins/jquery-migrate-1.1.1.js?c=-62169984000
    

    and in the console, "jQuery is not defined" from the script above. The page never seems to complete, and there is nothing seemingly of interest in the log. That seems to think the page has completed.

    This is using the either the master or dev versions of the Forms module.

  • So I still have this problem with CMS defined forms when using 'javascript submit' = 'yes'.

    Clicking Submit shows an 'undefined' message (jQuery undefined) in the 'messages' element, before rendering nothing but the jquery migrate tag (whilst submitting to the same page as the origin form). The page never completes.

    Not setting the 'javascript submit' option in the module admin doesn't cause an issue, and using the 'validate' option is OK too.

    All the scripts are loading (validate, additional-methods, jquery.forms, forms).

    The call to ajaxSubmit() occurs (so maybe the fault is in jquery.forms.js), but I haven't had time to investigate further.

  • Does this error happen if you are not logged into the CMS?

  • I hadn't tried that, and I just now have.

    Logged out of the admin, the messages element shows 'Undefined' briefly, but the form does submit and return, with the expected "After submit text" message.

    Presumably the "undefined" text should have the "javascript waiting message" instead? That is defined in the admin, but doesn't ever appear.

  • Are you able to capture what line number and file the Undefined is coming from?

  • Hello Admin,

    I had added form module and created a from from backend.

    And now I written a below code in view,
    $form = $this->fuel->forms->get('contact');
    echo $form->render();

    but I get en error saying:
    Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /Users/prayas/Documents/htdocs/mysite/fuel/application/views/_blocks/contact.php on line 1

    Please help me.

  • There could be a few different things in play here. I would test first to see if the error displays if you don't echo it. Also, I'd change the field types to see if one of the field types is causing the issue. Lastly, do you have an issue if simply create the form in the config without using the backend?

  • Hi Admin,

    I solved the issue doing (Form created on backend):
    $CI->load->module_helper(FORMS_FOLDER, 'forms');
    echo form('contact');

    Now, I got an another issue that is page goes blank while submitting the form.

Sign In or Register to comment.