Form Implementation

I'm using the Forms module in Fuel. I have it installed in the admin and in the database. However, I cannot figure out how to call the form I made. Do I have to create a layout for it in Fuel, or is it automatically generated.

The forms fields I have are:
Inquiry (drop down)

Any help on the matter would be appreciated.


  • edited 6:28AM
    There is a form function you can call in which you pass it the key of your form:

    That function is simply just a wrapper around:
    $CI =& get_instance(); echo $CI->fuel->forms->get('my_form')->render();
  • edited 6:28AM
    I got the form to show up, but when I test it I get an error:

    Fatal error: Call to a member function errors() on a non-object in /var/www/vhosts/ on line 60



    Severity: Error

    Message: Call to a member function errors() on a non-object

    Filename: controllers/Forms.php

    Line Number: 60

  • edited 6:28AM
    I was able to get it to display this message:

    Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
  • edited 6:28AM
    So it sounds like you were able to get the form to display but upon submission of the form you are getting the PHP mail error correct? If so, perhaps try this:
  • edited March 2018
    I have this for the code for my email.php page. The mail is setup through gsuite.
    public $protocol = 'smtp'; // mail/sendmail/smtp /** * STMP Server host * * @var string */ public $smtp_host = ''; /** * SMTP Username * * @var string */ public $smtp_user = ''; /** * SMTP Password * * @var string */ public $smtp_pass = '*********'; /** * SMTP Server port * * @var int */ public $smtp_port = 465; /** * SMTP connection timeout in seconds * * @var int */ public $smtp_timeout = 7; /** * SMTP persistent connection * * @var bool */ public $smtp_keepalive = TRUE; /** * SMTP Encryption * * @var string empty, 'tls' or 'ssl' */ public $smtp_crypto = 'ssl'; /** * Whether to apply word-wrapping to the message body. * * @var bool */ public $wordwrap = TRUE; /** * Number of characters to wrap at. * * @see CI_Email::$wordwrap * @var int */ public $wrapchars = 76; /** * Message format. * * @var string 'text' or 'html' */ public $mailtype = 'html'; /** * Character set (default: utf-8) * * @var string */ public $charset = 'iso-8859-1'; /** * Alternative message (for HTML messages only) * * @var string */ public $alt_message = ''; /** * Whether to validate e-mail addresses. * * @var bool */ public $validate = FALSE; /** * X-Priority header value. * * @var int 1-5 */ public $priority = 3; // Default priority (1 - 5) /** * Newline character sequence. * Use "\r\n" to comply with RFC 822. * * @link * @var string "\r\n" or "\n" */ public $newline = "\r\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822) /** * CRLF character sequence * * RFC 2045 specifies that for 'quoted-printable' encoding, * "\r\n" must be used. However, it appears that some servers * (even on the receiving end) don't handle it properly and * switching to "\n", while improper, is the only solution * that seems to work for all environments. * * @link * @var string */ public $crlf = "\n";
  • edited 6:28AM
    And this is the output when the form is sent - it shows up at the bottom of the page after the user presses send:

    220 ESMTP l64sm13541012pfi.142 - gsmtp
    hello: at your service, []
    250-SIZE 35882577
    250 SMTPUTF8
    from: 250 2.1.0 OK l64sm13541012pfi.142 - gsmtp
    data: 503 5.5.1 RCPT first. l64sm13541012pfi.142 - gsmtp
    The following SMTP error was encountered: 503 5.5.1 RCPT first. l64sm13541012pfi.142 - gsmtp
    reset: 250 2.1.5 Flushed l64sm13541012pfi.142 - gsmtp
    Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
    Date: Thu, 15 Mar 2018 20:22:14 -0700
    From: "Website Form Submission"
    Subject: =?UTF-8?Q?Message=20from=20Website?=
    User-Agent: CodeIgniter
    X-Mailer: CodeIgniter
    X-Priority: 3 (Normal)
    Message-ID: <>
    Mime-Version: 1.0

    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit

    The following information was submitted from the Contact form:

    Name: Name
    Message: Send us a message
  • edited 6:28AM
    Are you directly editing the core library Email.php file? If so, I'd recommend either extending it with a fuel/application/libraries/MY_Email.php or create a fuel/application/libraries/email.php file.

    If you are seeing the email debugging message, it means the email wasn't sent (see line 1154 of fuel/modules/forms/library/Fuel_forms.php). You may have some issues with your SMTP settings. Also, if you want, I would test your mail outside of FUEL and using CodeIgniter's email library (which is what the Form module is using):
  • This issue with forms only happens when I point the MX records to Google Mail using g-suite. If I don't point the MX records away from the server then the forms work fine.

Sign In or Register to comment.