CGBetterForms

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

CGBetterForms

Post by MantaPro »

Bit mystified by current issue!

Got a simple contact form, which is throwing an exception but I'm not sure why

Getting the message "Please specify a form name when calling CGBetterForms" which is from line 12 from CGBetterForms/action.default.php in response to this

Code: Select all

$formname = \cge_param::get_string($params,'form');
not finding the form param.

Tried Calguys Advanced Contact Form which works OK; I've compared the my and CG's Adv templates and the generated HTML - can't see anything missing.

Also looking at the Post headers that the form sent; the form seems to be sending all of the necessary hidden fields including the form name
Image

Ideas ?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1625
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: CGBetterForms

Post by DIGI3 »

Any special characters in the name of the form?
Not getting the answer you need? CMSMS support options
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

Re: CGBetterForms

Post by MantaPro »

Thanks for the reply DIGI3

No just capital letters and spaces

Code: Select all

{CGBetterForms form="APEMTP Contact Officials"}
Template has the same name and my browser's inspector shows that the params sent within the POST look properly formed
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am
Location: The Netherlands

Re: CGBetterForms

Post by Gregor »

What version are you using? Did you try to downgrade and verify?
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

Re: CGBetterForms

Post by MantaPro »

Thanks for the reply Gregor - I had ment to include system info - apologies forgot.

On a hosted server (pre production)
CMSMS 2.2.10
CGBetterForms 1.9.5
CGExtensions 1.62.8

Same form produces the same error on my Dev laptop running Xampp + Xdebug
CMSMS 2.2.10
CGBetterforms 1.9.2
CGExtensions 1.62.3
There have been numerous CGBF & CGE releases in the last week - I haven't aligned DEV yet - but in this case it helped

I'll try putting some var_dump() s in action.default.php this evening to see what is going on

Code: Select all


----------------------------------------------

Cms Version: 2.2.10

Installed Modules:

    AdminSearch: 1.0.4
    CGBetterForms: 1.9.5
    CGContentUtils: 2.3
    CGExtensions: 1.62.8
    CGSharedContent: 1.0.1
    CGSimpleSmarty: 2.2.1
    CGSmartImage: 1.22.5
    CGUserDirectory: 1.5.1
    CMSContentManager: 1.1.7
    CMSMailer: 6.2.14
    CmsJobManager: 0.1.3
    DesignManager: 1.1.6
    FEUMailer: 0.9.4
    FileManager: 1.6.8
    FilePicker: 1.0.4
    FormBuilder: 0.8.1.6
    FrontEndUsers: 2.14.2
    JMFilePicker: 1.0.1
    MenuManager: 1.50.3
    MicroTiny: 2.2.4
    ModuleManager: 2.1.6
    NMS: 2.13.3
    Navigator: 1.0.9
    News: 2.51.5
    Search: 1.51.6


Config Information:

    php_memory_limit:
    max_upload_size: 10000000
    url_rewriting: none
    page_extension:
    query_var: page
    auto_alias_content: true
    locale: en_CA
    set_names: true
    timezone: America/New_York
    permissive_smarty: true


Php Information:

    phpversion: 7.3.4
    md5_function: On (True)
    json_function: On (True)
    gd_version: 2
    tempnam_function: On (True)
    magic_quotes_runtime: Off (False)
    E_ALL: 24573
    E_STRICT: 2048
    E_DEPRECATED: 0
    test_file_timedifference: No time difference found
    test_db_timedifference: No time difference found
    create_dir_and_file: 1
    memory_limit: 32M
    max_execution_time: 60
    register_globals: Off (False)
    output_buffering: 1
    disable_functions:
    open_basedir:
    test_remote_url: Success
    file_uploads: On (True)
    post_max_size: 10M
    upload_max_filesize: 10M
    session_save_path: /tmp (1777)
    session_use_cookies: On (True)
    xml_function: On (True)
    xmlreader_class: On (True)
    check_ini_set: On (True)
    curl: On


Performance Information:

    allow_browser_cache: Off (False)
    browser_cache_expiry: 60
    php_opcache: Off (False)
    smarty_cache: Off (False)
    smarty_compilecheck: On (True)
    auto_clear_cache_age: On (True)

Server Information:

    Server Software: Apache
    Server Api: cgi-fcgi
    Server Os: Linux 4.4.0-ui19102.015-uiabi1-infong-amd64 On x86_64
    Server Db Type: MySQL (mysqli)
    Server Db Version: 5.5.60
    Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable


Permission Information:

    tmp: /homepages/38/d242029264/htdocs/apemtp_cmsms2/tmp (0705)
    tmp_cache: /homepages/38/d242029264/htdocs/apemtp_cmsms2/tmp/cache (0705)
    templates_c: /homepages/38/d242029264/htdocs/apemtp_cmsms2/tmp/templates_c (0705)
    modules: /homepages/38/d242029264/htdocs/apemtp_cmsms2/modules (0705)
    uploads: /homepages/38/d242029264/htdocs/apemtp_cmsms2/uploads (0705)
    File Creation Mask (umask): /homepages/38/d242029264/htdocs/apemtp_cmsms2/tmp/cache (0705)
    config_file: 0644

----------------------------------------------
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am
Location: The Netherlands

Re: CGBetterForms

Post by Gregor »

For a test, could you remove the spaces from the form name.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CGBetterForms

Post by calguy1000 »

It is not a problem with the form name. The error message explicitly means that CGBetterForms does not think you supplied a form argument at all (or an empty string).

So there is a typo or an invalid character in your template somewhere.

Tip: Use single quotes for fixed strings, it's faster.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

Re: CGBetterForms

Post by MantaPro »

Thanks for the reply Gregor

Tried it - removed all spaces - unfortunately still fails

As previously mentioned Calguys Avd form {CGBetterForms form="More advanced contact form"} worked OK - so still mystified.

I'll var_dump action.default.php and/or copy Calguy's form template and all of the same prerender; validation & Handler settings then mirgrate the template & settings bit by bit to try to isolate what is causing this behaviour

BTW - the template I am using has had all styling/framework; & all smarty except for the pre-form error handling removed - to make sure nothing else is interfering or corrupting the form & POST - and the scan of the template is clean - no warnings
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am
Location: The Netherlands

Re: CGBetterForms

Post by Gregor »

Check Calguy's reply.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CGBetterForms

Post by calguy1000 »

The issue here is that for some reason the 'id' passed in the mact is 'cntnt01' but the 'idprefix' passed with the 'form' parameter does not match.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

Re: CGBetterForms

Post by MantaPro »

Thanks for your replies Calguy and for investigating this

OK, what I have understood of your suggestions is the ID in the hidden field which is part of the mact parameter should match the id part of the hidden field of the form parameter

i.e. the two IDs highlighted should be identical

Image

whereas for comparison; the example Advanced Contact Form supplied with CGBF (with the intentional extraneous <foo> tag removed) - this forms works and the IDs are identical
Image

So both of these hidden fields are generated by CGBF I have no direct control over them; but presumably something in either the CGBF settings for my form (pre render logic; validation; handlers; disposition) or more likely in the template is causing CGBF to generate mismatched IDs

Here is the template currently being used (all smarty has been removed except for error messaging; all styling/framework removed and as Calguy suggested all static text has been changed to use single quotes) - template is called APEMTP contact officials

Code: Select all

{cgbf_form_errors assign='errors'}
{if !empty($errors)}
  <ul class='error'>
  {foreach $errors as $err}
    <li>{$err}</li>
  {/foreach}
  </ul>
{/if}
<form>
  <fieldset>
    <legend>Contact a Committee:</legend>
  <div>
     <label  for='myname'>Your Name:</label>
     <div>
       <input id='myname' name='myname' value="{$form_data->myname}" disabled  size='35'/>
     </div>
  </div>

  <div>
     <label  for='myemail'>Your Email:</label>
     <div>
       <input id='myemail' type='email' name='email' value="{$form_data->email}" disabled size='35'/>
     </div>
  </div>

  <div>
     <label  for='lot'>Lot #:</label>
     <div>
       <input id='lot' name='lot' value="{$form_data->lot}" disabled size='35'/>
     </div>
  </div>

  <div>
     <label  for='phone'>Phone Number (nnn-nnn-nnnn):</label>
     <div>
       <input id='phone' type='text' name='phone' value="{$form_data->phone}" pattern="{literal}^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})${/literal}" size='35'/>
     </div>
  </div>

  <div>
     <p>Please contact me via:</p>
     <div>
       <label><input type='radio' name='contact_by' value='email' data-cgbf-label='Contact Via' data-cgbf-selected="{$form_data->contact_by|default:'email'}"/> Email</label><br />
       <label><input type='radio' name='contact_by' value='phone' data-cgbf-selected="{$form_data->contact_by|default:'email'}"/> Phone</label>
     </div>
  </div>

  <div>
     <label for='dest' data-cgbf-label>Select the committee to send your message to:</label>
     <div>
        <select id='dest' name='dest' data-cgbf-required data-cgbf-selected='admin' multiple>
           <option value='build' data-cgbf-human='Construction Committee'>Construction Committee - re. House Build</option>
           <option value='admin' data-cgbf-human='Admin Committee'>Admin Committee - re. everything else</option>
        </select> 
     </div>
  </div>

  <div>
     <label for='comments'>Your Enquiry:</label>
     <div>
        <textarea id='comments' name='comments' data-cgbf-required  rows='10' cols='27'>{$form_data->contents}</textarea>
     </div>
  </div>

  <div>
    <button type='reset'>Reset</button>
    <button type='submit'>Submit</button>
  </div>
</fieldset>
</form>

This scans cleanly by CGBF; and when CGBF renders the form at the front end HTML Validator does not find any errors or warnings; I've stared at the form for a while in a HTML editor with syntax highlighing and I can't see special characters that might trip up CGBF

Here is the source of the form as rendered in the front end

Code: Select all

<form method="post" action="http://www.apemtp.org/index.php?page=copy-of-form-test" enctype="multipart/form-data">
  <fieldset><legend>Contact a Committee:</legend>
  <div>
     <label for="myname">Your Name:</label>
     <div>
       <input id="myname" name="myname" value="Phil SCOLTOCK & Heather FARRANT" disabled size="35"></div>
  </div>

  <div>
     <label for="myemail">Your Email:</label>
     <div>
       <input id="myemail" type="email" name="email" value="philip.scoltock@gmail.com" disabled size="35"></div>
  </div>

  <div>
     <label for="lot">Lot #:</label>
     <div>
       <input id="lot" name="lot" value="4-20" disabled size="35"></div>
  </div>

  <div>
     <label for="phone">Phone Number (nnn-nnn-nnnn):</label>
     <div>
       <input id="phone" type="text" name="phone" value="" pattern="^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$" size="35"></div>
  </div>

  <div>
     <p>Please contact me via:</p>
     <div>
       <label><input type="radio" name="contact_by" value="email" data-cgbf-label="Contact Via" data-cgbf-selected="email" checked> Email</label><br><label><input type="radio" name="contact_by" value="phone" data-cgbf-selected="email"> Phone</label>
     </div>
  </div>

  <div>
     <label for="dest" data-cgbf-label>Select the committee to send your message to:</label>
     <div>
        <select id="dest" name="dest[]" data-cgbf-required data-cgbf-selected="admin" multiple><option value="build" data-cgbf-human="Construction Committee">Construction Committee - re. House Build</option><option value="admin" data-cgbf-human="Admin Committee" selected>Admin Committee - re. everything else</option></select></div>
  </div>

  <div>
     <label for="comments">Your Enquiry:</label>
     <div>
        <textarea id="comments" name="comments" data-cgbf-required rows="10" cols="27"></textarea></div>
  </div>

  <div>
    <button type="reset">Reset</button>
    <button type="submit">Submit</button>
  </div>
</fieldset><input type="hidden" name="returnid" value="90"><input type="hidden" name="mcd06eform" value="APEMTPContactOfficials"><input type="hidden" name="mact" value="CGBetterForms,cntnt01,default,0&amp;cntnt01returnid=1"><input type="hidden" name="__guid" value="3B9590FA-3308-4BD7-A9CD-D7A7E73E23DD"><input type="text" style="display: none;" name="__hpname" value=""></form>
 
In CGBF; it has the following settings
Image
Image
Image
No validations rules set as yet
Image
(The first handler is deactived - at the moment the only handler active is it (should) send the form respone to me via email)
Image
And the page that uses it is simply
Image
(I could probably move the feu_smarty::get's to the PreRenderLogic to simplify the page)

Given the Adv contact form works - I will copy the template and replicate its CGBF settings then mutate it towards my "Contact a Committee" form one tab at a time; then one field at a time to isolate what it is in the template or settings that is tripping up CGBF
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

Re: CGBetterForms

Post by MantaPro »

Found it straight away - and logged a bug on CGBF

Image

The IDs highlighted above are identical, if on this tab the "Display form Inline" is set to NO.
Image

But as soon as it is set to Yes (because the form is in a sidebar) then these IDs are nolonger identical
Locked

Return to “Modules/Add-Ons”