Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
flexdummy #1
Submitting form
Can i know whether any1 know hw to submit our form after validating to another form where we can get the input from the first page for .mxml??
And can we insert data into SQL database using .mxml
flexdummy Guest
-
after submitting form go to page . . . .
I want the user to end up on a thank you page after submitting the form. How is that done? -
With ColdfusionMX6.x, is it possible to use the label after submitting the form
Hi, I have a form with labels, like <form> <label for="organisation" accesskey="o">Name of your organisation</label> <input type="text"... -
Use PDf fill in form in Website and submitting form info.
I feel like I'm 99% there, but I am missing something. I created the PDF form offline and tested submitting it. It works fine. When I upload and... -
Submitting Form Var Problem
I have two dropdown list: frm_cbo_top frm_cbo_bottom I have an OnChange="submit_form();" in each of these dropdown lists - the javascript... -
Submitting form with a unique ID
Hi All, I'm looking for some information/code samples on how I can create a simple web form that includes an auto-generated Unique ID on the... -
ntsiii #2
Re: Submitting form
I do not quite understand your question.
"Submit" is an html-world term and we do not really submit forms in Flex.
Instead, we use a data service call to send the data to some middle tier
application like JSP, Java, ASP.Net, CF, etc.
Say what you want to do in some other words.
Data is saved to a database by again using a call to a data service to send
the data to a middle tier program which does the actual save.
Tracy
ntsiii Guest
-
flexdummy #3
Re: Submitting form
I just want to submit the code below to another page that can display what i
type inside the textbox.My code is as shown below
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Model id="registration">
<name>{name.text}</name>
<email>{email.text}</email>
<phone>{phone.text}</phone>
<zip>{zip.text}</zip>
<ssn>{ssn.text}</ssn>
</mx:Model>
<mx:EmailValidator field="registration.email"/>
<mx:PhoneNumberValidator field="registration.phone"/>
<mx:ZipCodeValidator field="registration.zip"/>
<mx:SocialSecurityValidator field="registration.ssn"/>
<mx:Form defaultAction="Form2.mxml" >
<mx:FormItem label="Name" required="true">
<mx:TextInput id="name" width="200"/>
</mx:FormItem>
<mx:FormItem label="Email" required="true">
<mx:TextInput id="email" width="200"/>
</mx:FormItem>
<mx:FormItem label="Phone" required="true">
<mx:TextInput id="phone" width="200"/>
</mx:FormItem>
<mx:FormItem label="Zip" required="true">
<mx:TextInput id="zip" width="60"/>
</mx:FormItem>
<mx:FormItem label="Social Security" required="true">
<mx:TextInput id="ssn" width="200"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Place Order"
click="mx.validators.Validator.isStructureValid(th is,'registration');"/>
</mx:FormItem>
</mx:Form>
</mx:Application>
flexdummy Guest
-
ntsiii #4
Re: Submitting form
We still have a terminology problem.
We do not have "pages" in Flex. Try to explain again without using the words
"submit" or "page".
Do you want to display an order confirmation to the user? Do you want to
display a different view?
What is the business case here, I will try to help.
Have you looked at the Flex samples?
Tracy
ntsiii Guest
-
flexdummy #5
Re: Submitting form
i just want 2 display the text that i have type not on the same place as the textbox
flexdummy Guest
-
ntsiii #6
Re: Submitting form
Try this:
Tracy
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script><![CDATA[
private function placeOrder(oEvent):Void
{
var bIsValid:Boolean =
mx.validators.Validator.isStructureValid(this,'reg istration')
var sConf:String = "";
if (bIsValid) {
sConf += "Name: " + registration.name;
sConf += "\neMail: " + registration.email;
sConf += "\nPhone: " + registration.phone;
sConf += "\nZip: " + registration.zip;
sConf += "\nSSN: " + registration.ssn;
taOrderConf.text = sConf;
}
else {
alert("Entries must be valid in order to order.");
}
}
]]></mx:Script>
<mx:Model id="registration">
<name>{name.text}</name>
<email>{email.text}</email>
<phone>{phone.text}</phone>
<zip>{zip.text}</zip>
<ssn>{ssn.text}</ssn>
</mx:Model>
<mx:EmailValidator field="registration.email"/>
<mx:PhoneNumberValidator field="registration.phone"/>
<mx:ZipCodeValidator field="registration.zip"/>
<mx:SocialSecurityValidator field="registration.ssn"/>
<mx:Form >
<mx:FormItem label="Name" required="true">
<mx:TextInput id="name" width="200"/>
</mx:FormItem>
<mx:FormItem label="Email" required="true">
<mx:TextInput id="email" width="200"/>
</mx:FormItem>
<mx:FormItem label="Phone" required="true">
<mx:TextInput id="phone" width="200"/>
</mx:FormItem>
<mx:FormItem label="Zip" required="true">
<mx:TextInput id="zip" width="60"/>
</mx:FormItem>
<mx:FormItem label="Social Security" required="true">
<mx:TextInput id="ssn" width="200"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Place Order" click="placeOrder(event)"/>
</mx:FormItem>
</mx:Form>
<mx:TextArea id="taOrderConf" width="200" height="200" />
</mx:Application>
ntsiii Guest
-
ntsiii #7
Re: Submitting form
Try this:
Tracy
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script><![CDATA[
private function placeOrder(oEvent):Void
{
var bIsValid:Boolean =
mx.validators.Validator.isStructureValid(this,'reg istration')
var sConf:String = "";
if (bIsValid) {
sConf += "Name: " + registration.name;
sConf += "\neMail: " + registration.email;
sConf += "\nPhone: " + registration.phone;
sConf += "\nZip: " + registration.zip;
sConf += "\nSSN: " + registration.ssn;
taOrderConf.text = sConf;
}
else {
alert("Entries must be valid in order to order.");
}
}
]]></mx:Script>
<mx:Model id="registration">
<name>{name.text}</name>
<email>{email.text}</email>
<phone>{phone.text}</phone>
<zip>{zip.text}</zip>
<ssn>{ssn.text}</ssn>
</mx:Model>
<mx:EmailValidator field="registration.email"/>
<mx:PhoneNumberValidator field="registration.phone"/>
<mx:ZipCodeValidator field="registration.zip"/>
<mx:SocialSecurityValidator field="registration.ssn"/>
<mx:Form >
<mx:FormItem label="Name" required="true">
<mx:TextInput id="name" width="200"/>
</mx:FormItem>
<mx:FormItem label="Email" required="true">
<mx:TextInput id="email" width="200"/>
</mx:FormItem>
<mx:FormItem label="Phone" required="true">
<mx:TextInput id="phone" width="200"/>
</mx:FormItem>
<mx:FormItem label="Zip" required="true">
<mx:TextInput id="zip" width="60"/>
</mx:FormItem>
<mx:FormItem label="Social Security" required="true">
<mx:TextInput id="ssn" width="200"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Place Order" click="placeOrder(event)"/>
</mx:FormItem>
</mx:Form>
<mx:TextArea id="taOrderConf" width="200" height="200" />
</mx:Application>
ntsiii Guest
-
flexdummy #8
Re: Submitting form
How to use the HttpService?Bcoz my code below got error.Isit the httpservice
can post input of user to another form?
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*">
<mx:Script>
<![CDATA[
// Submit form is everything is valid.
private function submitForm():Void {
test.send();
}
]]>
</mx:Script>
<mx:HTTPService id="test"
url="http://localhost:8700/samples/forms/display.mxml" method="POST"
showBusyCursor="True">
<mx:request xmlns="">
<test1>{test1.text}</test1>
<test2>{test2.text}</test2>
</mx:request>
</mx:HTTPService>
<mx:Form x="34" y="25">
<mx:FormHeading label="Test Form"/>
<mx:FormItem label="Test 1" id="test1_lbl">
<mx:TextInput id="test1"/>
</mx:FormItem>
<mx:FormItem label="Test 2" id="test2_lbl">
<mx:TextInput id="test2"/>
</mx:FormItem>
<mx:Button label="Submit" id="sub_btn"
click="submitForm();" />
</mx:Form>
</mx:Application>
flexdummy Guest
-
flexdummy #9
Re: Submitting form
Ya.i have try your code above but can i make the textarea to be in another .mxml(not in the same page with the textbox).btw thank alot
flexdummy Guest
-
flexdummy #10
Re: Submitting form
Sorry for so many question.Coz i still have qns on storing this information into SQL database.
flexdummy Guest
-
takak #11
Re: Submitting form
Dear flexdummy,
Sounds like you need to get the basics nailed down. Check out the Flex
documentation and get yourself familiar with it.
Basically, you have Flex which is the user interface (and an awesome one at
that). You need some sort of scripting language and back-end. This is the
middle-tier application which Tracy is talking about. You should already have
this if you can work with databases in some other way? It can be an array of
things from ColdFusion to Java to PHP to ASP, whatever -- it doesn't really
matter that much.
I'll help you out here, but you should get yourself familiar with Flex and how
it works.
In your example, you have a request parameter with different variables
assigned to the text boxes on your page. This is not going to fly fully, though
you are on the right track.
Get rid of the xmlns = "" in your request param, it doesn't affect anything.
Change your submitForm function to:
private function submitForm():Void {
private var RequestVars:Object = new Object();
RequestVars.test1 = test1.text
RequestVars.test2 = test2.text
test.send(RequestVars);
}
Then on the back end, you handle the data like you would normally. Meaning you
read in the request variables, parse them as you please until your eyes turn
green, write the data to a database, update your database whatever, at that
point it's out of Flex land and into server-scripting land, whatever your
language of choice may be. I am not going to go into that here.
That's that. You can then pass back variables to Flex so that Flex can display
some sort of notice to the end-user. Remember, it's all XML. So, the output
would be something like:
<response message="Operation successful!"/>
And then you read that variable in by referring to
test.result.response.message. (Where test refers to your HTTPService as you
gave it the id of test).
That should be pretty clear and you should be able to figure it out from
there...
- Taka
takak Guest
-
flexdummy #12
Re: Submitting form
sorry takak i still don't get wat you mean can you show me the code of i
textbox and pass in to another.mxml that display the input inside the
textbox.As now i am struck with the above code as it couldn't pass the data to
another .mxml
Thank
flexdummy Guest
-
-
takak #14
Re: Submitting form
Dear flexdummy,
Sorry, it should be
<mx:HTTPService id="test"
url="http://localhost:8700/samples/forms/serve-side-page.jsp" method="POST">
you tracking?
You won't actually be redirected to the page. The data will be passed to the
page. You would then parse the data and output xml from that page. You would
then read the response back in by using test.result as your data source.
You tracking?
takak Guest
-
flexdummy #15
Re: Submitting form
Hw i can parse the data and output xml from that page. And then read the response back in by using test.result as your data source.
flexdummy Guest
-
takak #16
Re: Submitting form
Dear flexdummy,
I want to help you out but now you're asking very simple questions.
Do you know how to write ASP, JSP or PHP pages. You just simply read in the
request variables. in PHP it's ($_REQUEST), parse them, write them to a
database, etc. whatever and then you run an echo statement like:
"echo <response><message>Successful</message></response>"
or if it's unsuccessful:
"echo <response><message>Unsuccessful</message></response>"
then you refer to it by using test.result.response.message.
You should really get your misunderstoods cleared up on this subject and you
should get yourself more familiar with Flex.
Perhaps browse through some of the sample apps.
takak Guest
-
flexdummy #17
Re: Submitting form
can i noe wher to put the echo...?Most importantly where to put the test.result... so that i could read them from ASP page?Can u provide sample code for me coz i so stupid
flexdummy Guest
-
flexdummy #18
Re: Submitting form
My code below still gt error hw come??
HTTPService Fault: Could not retrieve data
My asp code is also shown below.Could some1 help?
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*">
<mx:Script>
<!]>
</mx:Script>
<mx:HTTPService id="test"
url="http://localhost:8700/samples/forms/display.asp" method="POST">
<mx:request>
<test1>{test1.text}</test1>
<test2>{test2.text}</test2>
</mx:request>
</mx:HTTPService>
<mx:Form x="34" y="25">
<mx:FormHeading label="Test Form"/>
<mx:FormItem label="Test 1" id="test1_lbl">
<mx:TextInput id="test1"/>
</mx:FormItem>
<mx:FormItem label="Test 2" id="test2_lbl">
<mx:TextInput id="test2"/>
</mx:FormItem>
<mx:Button label="Submit" id="sub_btn" click="submitForm();" />
</mx:Form>
</mx:Application>
###########display.asp#########
<%
Dim stCatname, ststatus
stCatname = request.form("test1")
ststatus = request.form("test2")
response.Write(test1)
%>
flexdummy Guest



Reply With Quote

