Jump to content

FormBuilder - send tests to test admins


Peter Knight
 Share

Recommended Posts

I have a few web forms which require testing on a weekly basis and I don't want the recipients (administrators) to receive these test emails.

What would be a good way to test approx 15 forms from the front end and have the test delivered a list of secondary administrator recipients?

I'm thinking that I could have some kind of config file which watches for a trigger word or email and then understands that it's a test and to bypass the normal admins?

All of the forms ask for an email address so I could setup an email such as 'testform@email.not' etc which my config file (hook?) would watch for.

Or is there a better way to do this?

Additionally, I have a few extra requirements...

  1. Forms should goto an alternative success page. This is because I don't want my test to skew my Google Analytics conversion tracking
  2. Forms would need to be tested from the front-end and not the PW admin area

Any advice appreciated.

BTW I realise this should be posted in the proper FormBuilder support forum. I am in the process of renewing my license for access to that support forum.

 

Link to comment
Share on other sites

4 hours ago, Peter Knight said:

I'm thinking that I could have some kind of config file which watches for a trigger word or email and then understands that it's a test and to bypass the normal admins?

 

Or a query param if you set the forms to use the url params?

Otherwise sound like a plan, check for a specific email and just update the form settings you need to, before processing. I haven't really been exactly in your scenario, but a hook does feel like the best option here and have used hooks extensively to hack form builder and works wonders.

I then use either a chrome extension to fill the forms, for example this extension always uses the domain "xxx@mailinator" . Or write a small javascript that fills the forms and I call it from the browser console if i need more control.

Link to comment
Share on other sites

6 hours ago, Peter Knight said:

require testing on a weekly basis

Why do you need to test them so often?

The obvious advice would be: Test them on the development instance of the site.

Depending on embed method (A-D), a query string may or may not work.

Perhaps with a hook that checks for user-role?

$this->addHookBefore('FormBuilderProcessor::emailForm', $this, 'testEmails');

protected function testEmails(HookEvent $event) {
	/* @var InputfieldForm $form */
	$form = $event->arguments(0);
    if ($user->hasRole("email-tester") && $config->emailTesting === true) {
 	    $recipient = $form->getChildByName('recipient');
	    $recipient = 'foo@admin.com'; // or put inside $config too
        // some re-definition of the landing page, e.g. add query string or pseudo-landing page, or real-landing-page-url + url-segments /test-only/
    }
}

 

  • Like 2
Link to comment
Share on other sites

On 11/4/2019 at 6:23 PM, dragan said:

Why do you need to test them so often?

The obvious advice would be: Test them on the development instance of the site.

Depending on embed method (A-D), a query string may or may not work.

Perhaps with a hook that checks for user-role?


$this->addHookBefore('FormBuilderProcessor::emailForm', $this, 'testEmails');

protected function testEmails(HookEvent $event) {
	/* @var InputfieldForm $form */
	$form = $event->arguments(0);
    if ($user->hasRole("email-tester") && $config->emailTesting === true) {
 	    $recipient = $form->getChildByName('recipient');
	    $recipient = 'foo@admin.com'; // or put inside $config too
        // some re-definition of the landing page, e.g. add query string or pseudo-landing page, or real-landing-page-url + url-segments /test-only/
    }
}

 

Thanks @dragan. Nice idea re. checking via user role.

Quote

Why do you need to test them so often?

The forms generate a significant amount of web leads and are under heavy usage. Typically any enquiry needs to successfully route through all of the following which all need to be working perfectly

1. the website itself and the form
2. any SMTP configuration module
3. Our SMTP mail delivery service
4. Client's end email address

We had an incident recently whereby the SMTP mail delivery service had a bounce from a client email address due to an IT outage. It then incorrectly flagged an organisation as inactive and stopped sending all future leads. The represents wasted leads but also wastage of AdWords budget etc.

So essentially it's an SLA thing for reassurance to make sure everything is working.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By joe_ma
      Sorry for asking this question here, but I cannot ask it in the VIP section because I use an version of FormBuilder that is expired.
      I have a fairly simple form on a website done with FormBuilder (PW 3.0.148, FormBuilder 0.2.4) that seems to work quite well. I've tested it with Firefox (88.0.1), Chrome, Opera, Edge and it works in all browsers as expected. The form is embedded in the page by pasting the name of the form in the body field.
      Now my customer tells me, that her Firefox (88.0.1) is blocking the page where the form is embedded: "Firefox may not open this page" for safety reasons.
      I have no clue as to what seems to be the problem here, since the form is on the same server and has the same domain.
    • By rooofl
      Hi! I am trying to create a hook that takes the value of a form file field, and add it to an image gallery of an existing page.
      $forms->addHookBefore('FormBuilderProcessor::processInputDone', function($e) { $form = $e->arguments(0); if($form->name == 'new-inuse') { // related_font is a page selector $font = $form->getChildByName('related_font'); // getting the page name $fontName = $font->attr('value')->name; // finds the page from its name $fontPage = wire('pages')->find("name=$fontName"); // in_use_image is a file upload field $image = $form->getChildByName('in_use_image'); // trying to add the image to the existing image gallery in_use field $fontPage->in_use->add('$image'); // error here $fontPage->save(); } }); This outputs the following error: `Call to a member function add() on null`. Any idea what’s wrong with my code?
    • By 999design
      Hi all,
      Running into an odd error that I can't seem to get my head around.
      We have 2 separately created Formbuilder forms sitting on a single page.
      But we keep experiencing weird results with them, originally we couldn't get one of the forms to ever submit so we ended up disabling CSRF for them which let us get around this issue.
      However it then causes a problem in that with CSRF disabled, one of forms always records 2 entries on submission. Just a straight duplicate within the entries for that form.
      So trying to stop this happening we tried enabling CSRF again and although that does stop the duplicated entry, it ends up giving really weird feedback such as the attached screengrab.
      Hazarding a guess I assume whatever is trigger on submission is firing twice because of the presence of the second form, but I have no idea why this would be the case as they are 2 seperately named forms?
      Any ideas?

    • By Richard Jedlička
      Tense    
      Tense (Test ENvironment Setup & Execution) is a command-line tool to easily run tests agains multiple versions of ProcessWire CMF.
      Are you building a module, or a template and you need to make sure it works in all supported ProcessWire versions? Then Tense is exactly what you need. Write the tests in any testing framework, tell Tense which ProcessWire versions you are interested in and it will do the rest for you.

      See example or see usage in a real project.
      How to use?
      1. Install it: 
      composer global require uiii/tense 2. Create tense.yml config:
      tense init 3. Run it:
      tense run  
      For detailed instructions see Github page: https://github.com/uiii/tense
       
      This is made possible thanks to the great wireshell tool by @justb3a, @marcus and others.
       
      What do you think about it? Do you find it useful? Do you have some idea? Did you find some bug? Tell me you opinion. Write it here or in the issue tracker.
    • By cosmicsafari
      Hi all,
      I have the same form on multiple pages, the idea being that I can populated a hidden field with a page specific value automatically.
      I figured this should be reasonably straight forward but I can't seem to get the following to take effect.
      <?php echo $forms->embed ('my-form-name', array('hidden_field_name' => '666')); ?> No matter what I do, it never updates the default value currently set for said hidden field.
      Feels like I'm missing something really obvious?
      Any ideas?
×
×
  • Create New...