We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    Hi there! I hope someone can help me with this little problem I’ve got.. It seems so easy..

    I’ve got a Flash form in which users can fill in their name and press a button. They are then redirected to another page, and the name they filled in is sent through POST and made into a placeholder (this works, I can see the name on the page with the placeholder). Here comes the problem: On this page there is another form (eForm). My idea is to put the name the user already filled in in the Flash form as a hidden input value in the eForm on this page (so I can use it later on). Besides this hidden name field the user also has to fill out some more formfields on this page and then the whole thing gets emailed through eForm. The only thing I cannot get working is to show the filled in name as a value in eForm.

    These are the pages, snippets and chunks I’ve got:

    page with FLASHFORM:
    With Flash/php the following var is set:
    $flash_name > sent with POST


    snippet [[flash_vars]]:
    $flash_name = $_POST['flash_name'];
    $modx->setPlaceholder('flash_name', $flash_name);


    chunk {{eForm_flash}}:
    <input type="hidden" name="flash_name" id="flash_name" value="[+flash_name+]" /><!-- value is blank :( -->


    Document "Contact us":
    [!flash_vars!]
    
    [+flash_name+] <!-- Just a test, but this works!! -->
    
    [!eForm? &formid=`eForm_flash` &to=`[email protected]` &tpl=`eForm-flash-form` &report=`eForm-flash-email` 
    &thankyou=`eForm-flash-thanks` &mailselector=`department` &vericode=`0` &subject=`Contact form`!]


    I also tried to write the hidden fields as output in the flash_vars snippet and include the snippet in the eForm_flash chunk as part of the form. This works the first time, but when there’s an error in the form and the page refreshes the data is lost.

    I must be doing some simple thing wrong...
    Any help would be much appreciated!
      • 10449
      • 956 Posts
      Have you tried to include the snippet call directly inside the chunk? i.e.
      snippet [[flash_vars]]:
      return($_POST['flash_name']);


      chunk {{eForm_flash}}:
      <input type="hidden" name="flash_name" id="flash_name" value="[!flash_vars!]" />


      If that doesn’t work, try finding a solution here:
      http://modxcms.com/forums/index.php/topic,8572.0.html
        • 19328
        • 433 Posts
        Thanks ganeshXL, I think what you’re suggesting would work (haven’t had the time to try it yet). But there’s a chance there will be multiple variables that have to be filled in in the Flashform. In that case your solution wouldn’t work I think, or I would somehow have to make separate snippets for each variable.

        I’ll check out the other topic and see if I can get it working.
          • 10449
          • 956 Posts
          you could alter the snippet to accept a var parameter, and then use switch/case statement to return only what you want, i.e.

          [!postVar? &var=`name`!]
          [!postVar? &var=`zip`!]
          [!postVar? &var=`city`!]

          etc.
            • 19328
            • 433 Posts
            Thank you!! That’s exactly what I need! It works perfectly.
            I didn’t think of the option to include variables in the snippet call. Very useful!

            Thanks for helping me learn the ins & outs of MODx! wink
              • 20930
              • 6 Posts
              FLASHFORM:

              I am not able to make it send the contact, I believe that my script is slide Action:

              Flash:
              package classes
              {
              	import flash.events.*;
              	import flash.display.*;
              	import flash.media.*;
              	import flash.net.*;
              	import flash.utils.*;
              	
              	public class contato extends Sprite
              	{
              		public var envia:URLLoader = new URLLoader();
              		public var vars:URLVariables = new URLVariables();
              		public var url:URLRequest = new URLRequest("http://www.domain.com/contato.html");
              		
              		public function contato():void
              		{
              			bt_envia.buttonMode = true;
              			bt_envia.addEventListener(MouseEvent.CLICK, this.enviaContato);
              		}
              		public function enviaContato(evt:MouseEvent):void
              		{
              			var vars:URLVariables = new URLVariables("flash_nome="+nome.text+"&flash_email="+email.text+"&flash_mensagem="+mensagem.text);
              			//vars.flash_nome = nome.text;
              			//vars.flash_email = email.text;
              			//vars.flash_mensagem = mensagem.text;
              			
              			envia.dataFormat = URLLoaderDataFormat.VARIABLES;
              			url.method = URLRequestMethod.GET;
              			url.data = vars;
              			trace(url.data)
              			
              			envia.load(url);
              			envia.addEventListener(Event.COMPLETE, this.enviado);
              			
              		}
              		public function enviado(evt:Event):void
              		{
              			trace("Evenviado");
              		}
              	}
              }
              
              


              SNIPPET

              <?php
              $flash_nome 	= $_POST['flash_nome'];
              $modx->setPlaceholder('flash_nome', $flash_nome);
              $flash_email	= $_POST['flash_email'];
              $modx->setPlaceholder('flash_email', $flash_email);
              $flash_mensagem 	= $_POST['flash_mensagem'];
              $modx->setPlaceholder('flash_mensagem', $flash_mensagem);
              ?>
              
              


              CHUNK

              <form method="post" action="[~[*id*]~]" id="EmailForm" name="EmailForm">
              
              		<input name="formid" type="hidden"  value="ContactForm" />
              		<input name="flash_nome" id="flash_nome" class="text" type="text" value="[+flash_nome+]" />
              		<input name="email" id="cfEmail" class="text" type="text" value="[+flash_email+]" /> 
              		<textarea name="message" id="cfMessage" rows="4" cols="20" >[+flash_mensagem+]</textarea>	
              		<input type="submit" name="contact" id="cfContact" class="button" value="Send This Message" />
              
              </form>


              PAGE

              [!flash_vars!]
              [+flash_nome+]
              [+flash_email+]
              [+flash_mensagem+]
              [!eForm? &formid=`ContactForm` &subject=`rthdtrjrjrtjrtj` &to=`[email protected]`  &tpl=`ContactForm` &report=`ContactFormReport` &gotoid=`46` &vericode=`0`  !]
              
              


              any help is welcome!

              Thanks
                • 20930
                • 6 Posts
                believe that this chunk wrong!

                someone help me?