Search code examples
modxmodx-evolution

Illegal string offset 'formid'


On main page of MODx site with snippet code

[!eForm? 
    &formid=`forma_bron` 
    &tpl=`forma_bron` 
    &to=`[email protected]`
    &report=`report-tpl` 
    &subject=`Request`  
    &eFormOnBeforeMailSent=`send`
!]

I get error:

Illegal string offset 'formid'

File : /home/users/account/domains/site/assets/snippets/eform/eform.inc.php

Line : 104

Source : $validFormId = ($formid==$_POST['formid'])?1:0;

Here is check on POST parameter although I call GET request when I try open main page.


Solution

  • The form handled by eForm on that page needs a hidden input with name="formid" and value="forma_bron".

    But since this is happening during a GET request, you have to change following code in eform.inc.php (around line 105)

    $validFormId = ($formid==$_POST['formid'])?1:0;
    

    to

    $validFormId = (isset($_POST['formid']) && $formid == $_POST['formid']) ? 1 : 0;