4 Replies Latest reply on Dec 16, 2014 10:37 AM by gptgeoff61

    Receiving INPUT TEXT, making Forms from scratch.

    Departure Level 1

      Hi All...

       

      I am trying to design a text form from scratch, How can i access to INPUT TEXT property of a text box ?

       

      I want to do this:

      -place a TEXT object on stage

      -have it RECEIVE INPUT TEXT (entered by user.)

      -Be able to access the INPUT TEXT in action panel so i can then use additional PHP stuff to send it as email or etc..

       

      I do not want to use those rectangular input box...i wanna create something totally ridicules lets say....(Somebody called this software EDGE and raised my expectations i guess )

        • 1. Re: Receiving INPUT TEXT, making Forms from scratch.
          EnthusiastOfTheMind Level 1

          Hi I'm fairly new to Edge, but I've managed to send data from input fields using the append/ajax method...

           

          //append input box to <div> in another symbol...

          //I have made a symbol called "contact_screen" on stage and this contains my input boxes (rectangle <div> called "InputEmail)

          var InputEmail = sym.getSymbol("contact_screen").$("InputEmail");

           

           

          //append the input field to your box. Note value is called to get the text content later

          $("<input type='text' value='' id='InputEmaili' size='80'>").appendTo(InputEmail);

          //set any css you want to the input field

          sym.getSymbol("contact_screen").$("#InputEmaili").css({"height":"29", "width":"492px", "font-family":"Annie Use Your Telescope, cursive", "font-size":"24px"});

          // do the same for your other input fields

           

           

          //then apply to a button click function

          var comp = sym.getComposition().getStage().getSymbol("contact_screen");

          //gets the values

          var name = comp.$("#InputNamei").attr("value");

          var email = comp.$("#InputEmaili").attr("value");

          var message = comp.$("#InputMessagei").attr("value");

          //sets the values as "data"

          var data = "name="+name+"&email="+email+"&message=" + message;

           

           

           

           

          $.ajax({

               type: "POST",

               url: "email/contact.php",

               //gets the data values

               data: data,

               success: function(phpReturnResult){

               alert('Thank you.'+'\r\n'+'Your message has been sent successfully!');

               //this resets the values after sent

               comp.$("#InputNamei").val("");

               comp.$("#InputEmaili").val("");

               comp.$("#InputMessagei").val("Your message has been sent.");

               sym.$("feedbackTxt").text("");

               },

               error: function(errormessage) {

                    alert('Sorry message failed to send: ' + errormessage);

               }

          });

          • 2. Re: Receiving INPUT TEXT, making Forms from scratch.
            EnthusiastOfTheMind Level 1

            I believe you have to append a <input type='text'> to a <div> whether its a rectangle or a text box. Its html .

            • 3. Re: Receiving INPUT TEXT, making Forms from scratch.
              EnthusiastOfTheMind Level 1

              The newer versions of Edge Animate (v2+, v3) doesn't seem to support some of the old syntax I've put up here, setting the value of an input text field needs changing from .attr("value") to .val() i.e....

               

              var name = comp.$("#InputNamei").attr("value");

               

              to

               

              var name = comp.$("#InputNamei").val();

              • 4. Re: Receiving INPUT TEXT, making Forms from scratch.
                gptgeoff61

                Hi, im trying to use the code you kindly shared here.

                 

                One question, where do you put the ajax code, is it in the button click function as at the moment when I click the button nothing happens

                 

                Regards

                Tiny