Appnitro Software Forums » MachForm

email back to submitter

(14 posts)
  • Started 1 year ago by roosenmachform
  • Latest reply from Willy

  1. I know how to make a form send email back to submitter. Is it possible to make this depend on a field on the form, where the submitter can indicate that he wishes a copy of his email?

    Posted 1 year ago #
  2. This would require some modification as well.
    What field would you like to use? A checkbox?

    Posted 1 year ago #
  3. yes

    Posted 1 year ago #
  4. Actually you can see the method that posted in here :

    http://www.appnitro.com/forums/topic/email-from-a-drop-downlist/page/2?replies=42

    That would show you how to send an email based on checkbox or drop down selection

    Posted 1 year ago #
  5. Willy
    Member

    Me too is interested in this option of only sending a copy of the submitted form to submitter if a checkbox is checked.

    I read the entire topic you refer to but am not able to see what exactly I should do.

    Can you please help me with the code needed for a checkbox option that makes mailing a copy of the submitted form optional?

    If checked send a copy, if not checked no copy is sent to form submitter.

    Actually, this would be a nice new option for a future version. ;)

    Posted 1 year ago #
  6. Willy
    Member

    Any chance of having a new look at this please?

    Posted 1 year ago #
  7. Hi Willy,

    Sorry for the delay, I thought your case was similar with the link posted above. After reading it again, it doesn't seem to be so.

    Ok, it's quite simple actually. Let's take a look into this form as an example:
    http://www.appnitro.com/forms/view.php?id=38

    It has an email field and a checkbox, which would make the mailing copy optional depends on your user selection.

    First of all, make sure to set the "Send To" dropdown, on your email settings, being set to your email field.

    Then to make it optional, we need to modify "includes/post-functions.php" file.
    around line 1206, you'll find this code:

    $user_email_param['target_is_admin'] = false; 
    
    send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);

    you need to modify it to become like this:

    $user_email_param['target_is_admin'] = false; 
    
    if($form_id == 38){
    	if(!empty($table_data['element_4_1'])){
    	send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    	}
    }else{
    	send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    }

    In the above example, my form is having id number ($form_id) = 38 and the checkbox id is "element_4_1" , so make sure to adjust them with your own form number and checkbox id.

    Posted 1 year ago #
  8. Willy
    Member

    Thanks Yuniar,

    No problems for the delay/misunderstanding, no hurries here.

    I tested your code in my own testform and am receiving a copy with and without the checkbox checked.

    Your testform didn´t send a mail in either case.

    I'm not a coder so I'm not sure but it looks to me like your code lacks some else statement for the case of the non-checked checkbox.
    I'm quite sure my code is like you say it has te be, form_id and checkbox_id are correct.

    $user_email_param['target_is_admin'] = false;

    if($form_id == 3){
    if(!empty($table_data['element_8_1'])){
    send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    }
    }else{
    send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    }

    Posted 1 year ago #
  9. Willy
    Member

    What markup is needed to post code as code?

    Posted 1 year ago #
  10. Willy
    Member

    After a bit more testing I found out that your code works when preview is OFF, with preview ON mail is send with and without the checkbox checked.

    I tried different solutions but my coding knowledge is too poor to be able to fix this.

    Posted 1 year ago #
  11. Ah.. yes, sorry I forgot to let you know that the above code will only work if you have form preview OFF.

    If you need to enable for both form preview ON or OFF, there are more code adjustment needed.

    First, you'll need to change the code I posted above to become like this:

    $user_email_param['target_is_admin'] = false; 
    
    if($form_id == 38){
    	if(!empty($table_data['element_4_1'])){
    	send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    $_SESSION['element_4_1'] = true;
    	}
    }else{
    	send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    }

    then you will also need to modify another lines of post-functions.php file.

    Search around line 2319 for this code (it's close at the bottom of the file):

    $user_email_param['target_is_admin'] = false;
    send_notification($form_id,$new_record_id,$esr_email_address,$user_email_param);

    change it using the same code I posted the first time above, like this:

    $user_email_param['target_is_admin'] = false; 
    
    if($form_id == 38){
    	if(!empty($table_data['element_4_1'])){
    	send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    	}
    }else{
    	send_notification($form_id,$record_insert_id,$esr_email_address,$user_email_param);
    }
    Posted 1 year ago #
  12. Willy
    Member

    Hello again Yuniar,

    Thanks for your answer, unfortunately, no email is sent to user whether checkbox is checked or not checked with review ON.

    With review OFF code works fine.

    As I only am going to use one life form that will have review enabled always I don´t care if the code will work with review OFF, I need this option only for a form with review ON.

    Don't know if this makes any difference for the code required.

    Posted 1 year ago #
  13. Willy,

    Can you send me your post-functions.php file please?
    Also, let me know the URL to your form.

    You can mail it to: customer.service [at] appnitro.com

    I'll check it.

    Posted 1 year ago #
  14. Willy
    Member

    Thank you for fixing this!

    Greetings.

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.