Riprovo sto imparando a fare un form con flash ed asp, ed ho scaricato un sample dal sito macromedia, di seguito posto il codice as e asp, lo sript mi chiede di cambiare il submitURL lo cambio con il mio dominio e carico il file asp, faccio un ordine e lo invio, nel campo message_txt mi appare the message was received ecc... quindi il mio file funziona, ora vorrei sapere cosa devo modificare nel file asp per cui all' invio dell' ordine da parte del swf mi viene inviata la risposta nel swf ma anche spedita un email ad un indirizzo di posta da me impostato, poichè questo sample non invia niente a nessuno ma ti fa solo vedere come comunica flash con un server o almeno questo ho capito...grazie mille spero di essere stato più chiaro a presto
actionscript:
/*
Change the value of sumbitURL to the URL
of the CF or ASP file on your server.
*/
submitURL = "http://localhost/handleSubmit.asp";
function onReset() {
quantity_cb.setSelectedIndex(0);
large_rb.setValue(true);
toppings_lb.setSelectedIndices(null);
toppings_lb.setScrollPosition(0);
message_txt.text = "";
selectAll_ch.setValue(false);
submit_btn.enabled = true;
}
function onSubmit() {
// Create a new LoadVars instance for the form data
formData = new LoadVars();
// Initialize formData variables:
formData.quantity = "";
formData.toppings = ["Cheese"];
formData.size = "";
// Gather the order information into a LoadVars instance.
formData.quantity = quantity_cb.getValue();
formData.size = sizeGroup.getValue();
toppingsObjectArray = toppings_lb.getSelectedItems();
for (var i = 0; i < toppingsObjectArray.length; i++) {
currentTopping = toppingsObjectArray;
formData.toppings = currentTopping.label;
}
// Create another LoadVars instance to receive the server's reply
replyData = new LoadVars();
// Initialize reply variable.
replyData.reply_quantity = "";
replyData.reply_size = "";
replyData.reply_toppings = [];
// Specify a function to call when this new instance receives the reply.
replyData.onLoad = handleReply;
// Submit the order data
formData.sendAndLoad(submitURL, replyData, "post");
// Tell the user what's happening.
message_txt.text = "Submitting order, please wait...";
}
function handleReply(success) {
if (success) {
message_txt.text = "Your order was received:\n";
message_txt.text += "Quantity: " + replyData.reply_quantity + newline;
message_txt.text += "Size: " + replyData.reply_size + newline;
message_txt.text += "Toppings: " + replyData.reply_toppings;
} else {
message_txt.text = "There was a problem submitting your order. The server may be down or not responding.";
}
}
function onSelectAll() {
if (selectall_ch.getValue() == true) {
toppings_lb.setSelectedIndices([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
toppings_lb.setEnabled(false);
} else {
toppings_lb.setSelectedIndices(null);
toppings_lb.setEnabled(true);
}
}
asp:
<%
Dim reply_size, reply_quantity, reply_toppings, returnToFlash
reply_size = Request.Form("size")
reply_quantity = Request.Form("quantity")
reply_toppings = Request.Form("toppings")
returnToFlash = "reply_size=" & Server.URLEncode(reply_size) & "&reply_quantity=" & Server.URLEncode(reply_quantity) & "&reply_toppings=" & Server.URLEncode(reply_toppings)
Response.Write returnToFlash
%>

Rispondi quotando