Form Module - view/_blocks - and submit button confusion.

rl2rl2
edited February 2018 in Modules
Hello,

I am trying to set out the template block file correctly. As you can see I am using Bootrstrap (v4) here to layout the form, bit of a kludge to get it work, but all good so far.

However, if I complete all the fields - Excluding the recaptcha object (v2 installed) and hit submit no warns that I have yet to complete the recaptcha appear - the page goes ahead and reloads.

/* i've used the form slug here in the action */

<?php foreach($fields as $field) : ?>

<?=$field['label']?>
<?=$field['field']?>

<?php endforeach; ?>



Comments

  • edited 5:14AM
    Is there a "error" flash data being sent to the page that you can display or do you have something like the following a the top of your page:
    <?=display_errors()?>
  • rl2rl2
    edited February 2018
    This is in fact quite tricky to test because the Recaptcha displays 'ERROR for site owner: Invalid domain for site key.' Despite adding 'localhost' and 'dev' domains into the 'admin console' on the relevant settings page. So maybe its meant to act that way?

    g-recaptcha-response: {empty}

    Whatever the case maybe no email is being received.

    EDIT: Just looked under Form Entries in Fuel and there is any entry from Friday, but none from this Morning suggesting something work :S
  • rl2rl2
    edited 5:14AM
    FYI if I turn off Recaptcha altogether and use honeypot the form still does not submit or send anything :(
  • edited 5:14AM
    I would test to see if it's making it to the forms controller on submit and then debug from there. The forms controllers is located at fuel/modules/controllers/Forms.php.

    Also, is the form embedded on a page created in the CMS. If so, turn of page caching for that page.
  • rl2rl2
    edited 5:14AM
    Still in development at the moment, so no caching turned on.

    No, it's not reaching the CI_Controller class.
  • rl2rl2
    edited February 2018
    Any further ideas?

    In principle is this correct? (sorry I just noticed my original post was missing html tags)
    
    <form method="POST">
    	<div class="row">
    	<?php foreach($fields as $field) : ?>
    		<div class="col-12 col-sm-6">
    			<?=$field['label']?>
    	    	<?=$field['field']?>
    	    </div>
    	<?php endforeach; ?>
    		<div class="col-12 col-md-6">
    		<input type="submit" class="btn btn-primary btn-lg btn-block" value="Request a Call Back">
    	</div>
    </form>
    
  • edited 5:14AM
    Ah... you need to put in the proper "action" parameter in your form tag.
    action="<?=site_url('forms/process/my_form_slug")?>
  • rl2rl2
    edited 5:14AM
    Brilliant, thought it would be something simple, thank you.
  • rl2rl2
    edited 5:14AM
    At the moment I am not receiving the email related to a completed form on local/dev server. How programmatically does it go about sending the email?
  • rl2rl2
    edited 5:14AM
    So Form Display is set to 'block'.. Block view is set to 'business-call-back' in the 'forms' module.

    In the Actions tab I have an empty Form action field, lorem ipsum in 'After submit text' (which doesn't show anywhere), my email address in Email recipients, a subject heading and an email message containing the words 'test message'.

    And a Return URL in the field.

    ----

    I have a feeling nothing in this Tab is missing used. :S
  • rl2rl2
    edited 5:14AM
    This is hard work, cannot even find out how to change the Content-Type to text/html
  • rl2rl2
    edited March 2018
    Now the To: field is empty :S
  • edited 5:14AM
    To check where things may be getting hung up I'd debug Fuel_forms::notify() method around line 1086 in fuel/forms/modules/forms/libraries/Fuel_forms.php. That method is what is used to send out the email using CI's Email class.
Sign In or Register to comment.