Building a recommend this website form

nrigo 12 May, 2008
Hello,

I'am already using Chronoforms and I would like to build a form to recommend the website to friends.

If somebody has some ideas and can help me, I would appreciate.

Here is what I would like to do:

Allowing input of 10 contact with firstname / name and e-mail adresses fields in the form.

Sending a personalized message for each recipients like:

Dear [firstname] [name],

sender [firstname] and [name][/i] recommends you to visit the website of our charity organisation...


Thank you in advance to provide me an approach for this,

Nicolas
GreyHead 13 May, 2008
Hi Nicholas,

Collect the data in an array by naming the fields friends['firstname'][], friends['lastname'][] and friends['email'][]

Then you can have a little PHP foreach loop in the 'OnSubmit after email' box that goes through the array and sends each friend a personalised email.

Bob
nrigo 13 May, 2008
Hello Bob,

Thank you for your answer.

I will try to do this in the next days.

Kind regards,

Nicolas
shabalaa 20 Feb, 2013
Hallo Bob,

I am still very new to web design and Chronoforms, but it is awesome! I have the same request that Nicholas had in 2007 and that is to create a "Recommend this Website/Webpage form".

How will I go about and what will the steps be that I need to follow to create such a form. I see you have mentioned the PHP for each loop - what will this PHP look like? How do I setup the array?

Your help in this regard will be greatly appreciated? Looking forward to your reply in this regard.

Thanks for all the work!

Stephan
GreyHead 20 Feb, 2013
Hi Stephan,

This is an old thread for a previous version of ChronoForms. Which version of ChronoForms and Joomla! are you using?

I suggest that you start by building a form for a recommendation to one friend to see how everything works. Then make a copy of that and adapt it to send to multiple friends. There is some code in this FAQ that will help with that.

Bob
shabalaa 20 Feb, 2013
Hallo Bob,

Thank you for your quick response. I am using the latest version for Joomla 3 V4_RC3.5.2.5_J3.0.

I understand the basics of Chronoforms and have been using it for the past three years. This is however the first time that I got a request for this type of form and I would use Chronoforms above any other component.

Kind Regards

Stephan
GreyHead 20 Feb, 2013
Hi Stephan,

That's good, you should have no problem with this project.

You may need to use my Email [GH] action to send separate emails to each recipient.

Bob
shabalaa 20 Feb, 2013
Thank you Bob,

I will follow your advice and see how it goes.

Thank you once again.

Stephan
shabalaa 05 Mar, 2013
Hallo Bob,

Have been batling with this and I need your help please?

How do you build a form for a recommendation to one friend or more?

Regards

Stephan
shabalaa 05 Mar, 2013
Is there any person that has created a recommend this website form before?

I need your help urgently please?

Regards

Stephan
GreyHead 05 Mar, 2013
Hi Stephan,

Help with what exactly?

Bob
shabalaa 05 Mar, 2013
Hallo Bob,

You must think I am stupid, but I need to build a form that people can recommend a website.

I have looked at all the posts and help sections and I even bought the ChronoForms Cookbook.

I need your help please?
GreyHead 05 Mar, 2013
Hi shabalaa,

I can't do help about everything and anything - I lost my magic wand :-(

Where exactly have you got to with your form? What is the exact problem you have? What have you tried so far? What help do you need with that step?

Bob
shabalaa 05 Mar, 2013
I have created a form with the following:
- Name & Surname
- e-mail
- Then I have added the following in my form wizard with Custom HTML or PHP
<?php
// set the total count
$count = 5;
for ( $i = 1; $i <= $count; $i++ ) {
  // add classes which will let us identify the inputs to hide
  if ( $i == 1 ) {
    $class = 'show_me';
  } else {
    $class = 'hide_me';
  }
  // add the 'Add one' buttons (but not to the last set)
  if ( $i < $count ) {
    $j = $i+1;
    $button = "<div><input type='button' name='addone_{$j}' id='addone_{$j}' value='Add one' class='add_one' /></div>";
  } else {
    $button = "";
  }
  // add the inputs with a little ChronoForms styling
  echo "<div id='recipient_{$i}' class='{$class}' >
  <div class='multiline_start'>
    <label>Name</label>
    <input type='text' name='recipient[{$i}][name]' id='recipient_{$i}_name' />
  </div>
  <div class='multiline_add'>
    <label>Address</label>
    <input type='text' name='recipient[{$i}][address]' id='recipient_{$i}_address' />
  </div>
  <div class='clear' ></div>
  {$button}
</div>";
}
?>


- In the events I have added the Load JS with the following code
window.addEvent('domready', function() {
  // hide all but the first set
  $$('div.hide_me').each(function(el) {
    el.setStyle('display', 'none');
  });
  // call the addOne function passing the row number  
  $$('input.add_one').each(function(el) {
    el.addEvent('click', function(event) {
      var id = event.target.id.substr(7, 1);
      addOne(id);
    });
  });
});
// display the next row and hide the last 'Add one' button
function addOne(id) {
  $('addone_'+id).setStyle('display', 'none');
  $('recipient_'+id).setStyle('display', 'block');
};


- On submitting it is not producing the information that I have enetered into the Name and (I have changed them to e-mail) boxes.
- I am also not clear on the Handle Arrays

Stuck at the moment
GreyHead 05 Mar, 2013
Hi shabalaa,

And what exactly isn't working?

Bob
shabalaa 05 Mar, 2013
- The e-mail that I receive after posting doesn't have the information that I have typed in in the e-mail. The information wasn't captured and sent.

- How do I create the fields that handles the e-mails that I enter that they get e-mailed individually?
GreyHead 05 Mar, 2013
Hi shabalaa,

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Bob
shabalaa 05 Mar, 2013
Here is the result:

Data Array:

Array
(
    [option] => com_chronoforms
    [tmpl] => component
    [chronoform] => charter_request
    [event] => submit
    [name_surname] => stephan
    [e-mail] => stephan@enigmadvent.co.za
    [e-mail2] => stephan@enigmadvent.co.za
    [recipient] => Stephan,design@shabalaa.com,Stephan,team@saathlete.com,Stephan,drumboot@enigmasa.com,,,,,,,,,,
    [input_textarea_8] => TEST TEST TEST
    [recaptcha_challenge_field] => 03AHJ_VusQnBRr8xQiTkH7_VovxI8m4iTPAuHQ_kFuF4A7FSQXynk4lJeXJPEYNhgme5Yrr1u9hw8Q8ho94ZGVd4kb46ZSOntR-24eKjlfFtHE_ZUTTPsDlPS1BMl-S-yGn28EVTrIgVFy0X46sYRxNu8uQbOPFBdbyRSG1KbWgTCY5e4RdZieCRU
    [recaptcha_response_field] => usher logyogr
    [input_submit_10] => SEND
    [b0b01cebd8a53fa017583e541d0004ba] => 1
)

Validation Errors:

Array
(
)

Thank you for your enquiry. As soon as our reservations department has processed your enquiry we will get back to you.
Debug Data

    email
        10
            Result An email has been SENT successfully from (Online Booking Form)team@enigmadvent.co.za to info@enigmadvent.co.za
            Body
            YOUR DETAIL
            *Name & Surname: 	stephan
            *e-mail: 	stephan@enigmadvent.co.za
            *Validate e-mail: 	stephan@enigmadvent.co.za
            FRIENDS INFORMATION
            Name
            e-mail
            Name
            e-mail
            Name
            e-mail
            Name
            e-mail
            Name
            e-mail
            Name
            e-mail
            Name
            e-mail
            Name
            e-mail
            Personal Message: 	TEST TEST TEST


            Submitted by 41.121.154.228
            Attachments array ( )

GreyHead 05 Mar, 2013
Hi shabalaa,

that looks OK, you have a list of emails in the 'recipients' input. It looks as though you have used a Handle Arrays action to convert these from an array to a comma separated list.

So that part is working OK.

Do you have {recipient} in the Email template?

Bob
shabalaa 06 Mar, 2013
Yes I have entered e-mail addressed into them, but they are not in the e-mail that I receive.
GreyHead 06 Mar, 2013
Hi shabalaa,

Do you have {recipient} in the Email template?

Bob
shabalaa 07 Mar, 2013
No. Where must this go in?
GreyHead 07 Mar, 2013
Hi shabalaa,

Where you want the list of recipients to show up . . .

Bob
This topic is locked and no more replies can be posted.