We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29181
    • 480 Posts
    What am I doing wrong...

    I’ve used it before without any trouble but with the

    &subject=`[+name+] filled out the website form`


    where name looks like

    <input id="name" class="formInput" maxlength="32" name="name" size="30" type="text" value="" /> 


    in the contact form. Now according to the new docs it should now be &subject=`[.name.] filled out the website form` but that isn’t working either.

    Using 0.9.6.3-RC1MODX and 1.4.4.5 EFORm...Can anyone offer a pointer please?

    Cheers,
    Taff
      Adrian Lawley: www.adrianlawley.com
      • 29181
      • 480 Posts
      Could it be that I’m using php 4.4.4?

      Cheers,
      Taff
        Adrian Lawley: www.adrianlawley.com
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        I’m having issues with the value="" setting when using eform as well... When I put value="test" it’s showing up as value="". How do you put default information in the inputs with eform?
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 20413
          • 2,877 Posts
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 25551 ☆ A M B ☆
            • 1,231 Posts
            Hmmm what I’m trying to do is create an eform that allows registered users email the creator of a particular document. My idea was to send the form to [*createdby*] email address and have it display which user sent the form. I’m not sure if this is possible with eform.
              Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
              AugmentBLU - MODX Partner

              BLUcart - MODX Revolution E-Commerce & Shopping Cart
              • 30223
              • 1,010 Posts
              Quote from: rossco at Nov 16, 2008, 11:08 AM

              I’m having issues with the value="" setting when using eform as well... When I put value="test" it’s showing up as value="". How do you put default information in the inputs with eform?

              eForm is currently not retaining default values for text input fields. By making the following change to eform.inc.php (version 1.4.4.5) you can change this behaviour:
              Find this block of code around line 817
              <?php //do not copy this line!
                 }elseif($fieldType=='checkbox' || $fieldType=='radio'){
                    $formats[$name][4]= $_lang['ef_failed_default'];
                    $formats[$name][5] .= isset($formats[$name][5])?",":"#LIST ";
                    //convert embedded comma's in values!
                    $formats[$name][5] .= str_replace(',',',',stripTagQuotes($tagAttributes['value']));
                    //store the id as well
                    $formats[$name][6] .= ( isset($formats[$name][6])?",":"").stripTagQuotes($tagAttributes['id']);
                 } //<-- INSERT NEW CODE HERE (replacing bracket)
              


              and insert this:
               
              <?php //do not copy this line!
               } else { //plain old text input field
                    //retain default value set in form template
                    $fields[$name] = stripTagQuotes($tagAttributes['value']);
                 }
              

              Quote from: rossco at Nov 16, 2008, 03:00 PM

              Hmmm what I’m trying to do is create an eform that allows registered users email the creator of a particular document. My idea was to send the form to [*createdby*] email address and have it display which user sent the form. I’m not sure if this is possible with eform.
              [*createdby*] will give you the user id, so you would have to retrieve the corresponding email address from the users settings first.
              Basically what I understand is that you want the TO email field to be the document creator and the FROM email field to be the currently logged in user (and perhaps the subject to something like the page_id or title)

              You could do this with an eForm event function where you retrieve the values from modx and add them to the $fields array -and- have some extra placeholders in your snippet call:

              For instance you could this function in the eFOrmOnBeforeMailSent event:
              <?php //do not copy this line!
              /**
              * eForm event function to retrieve logged in user and page creator details
              * Use following placeholders in eForm:
              * [+login_email+] & [+login_name+] for the logged in user
              * [+creator_email+] & [+creator_name+] for the page creator
              * [+page_title+] for page title
              */
              function beforeMailSentFunction(&$fields){
                 global $modx;
                 
                 if( ! $login_info = $modx->userLoggedIn() ){
                    $fields['validationmessage'] = "You are not logged in. Please log in before trying again.";
                    return false;
                 } 
                 //get logged in user details:
                 $user_info= = ($login_info['usertype']=='manager') ? 
                    $modx->getUserInfo($login_info['id']) : $modx->getWebUserInfo($login_info['id']);
                 //add to fields array
                 $fields['login_email'] =  $user_info['email']; 
                 $fields['login_name'] = $user_info['fullname'];
                 //get document title;
                 $fields['page_title'] = $modx->documentObject['pagetitle'];
                 //get document creator details
                 $cr_info = $modx->getUserInfo($modx->documentObject['createdby']);
                 $fields['creator_email'] = $cr_info['email'];
                 $fields['creator_name'] = $cr_info['fullname'];
                 
                 return true;
                 
              }
              


              and use a snippet call like this:
              [!eForm? &subject=`User comment on [+page_title+]` &to=`[+creator_email+]` &from=`[+login_email+]` &eformOnBeforeMailSent=`beforeMailSentFunction` !]
              


              I’m assuming you know how to get event functions to work.. otherwise see examples in this forum
              Check if you have PHx enabled. If you do the above will not work out of the box. See pixelchutes PHx workaround elsewhere (do a fourm search as I can’t remember...)



                • 25551 ☆ A M B ☆
                • 1,231 Posts
                I’m trying to get the to and from parameters to work still. I have tried and just don’t seem to get it working. I tried editing the eform file but it’s not working.
                  Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                  AugmentBLU - MODX Partner

                  BLUcart - MODX Revolution E-Commerce & Shopping Cart