Hi all!
can you write someting like this in Java:
myForm.attachEvent(“onButtonClick”, function(name) {
if (name == “send”) {
myForm.send(“asp/save_data.asp”,“post”,function(xml){
alert(“Saved”);
});
}
});
The alert does show up after pressing the button but the vbscript in the save_data.asp file doesn’t seem to be called.
Thanks for any suggestions/comments!
Marco
myForm.attachEvent("onButtonClick", function(name) {
if (name == "send") {
myForm.send("asp/save_data.asp","post",function(xml){
alert("Saved");
});
}
});
Sorry about that, I did not post the code properly…
myForm.attachEvent("onButtonClick", function(name) {
if (name == "send") {
myForm.send("asp/save_data.asp","post",function(xml){
alert("Saved");
});
}
});
Does anyone know why the asp script is not being called but the alert pops up?
Thanks!!
Marco
hi
are you sure asp script not called?
callback will not executed if something wrong
Thank you very much for your reply Andrei!
You ae saying that if there is an error in the script it won’t be called?
It doesn’t give me any errors at all!!
In fact I had tried to make a syntax error on purpose and nothing happend… do you have any suggestion on how to debug this situalion?
Thanks again!
Marco
Well,
do you have direct link?
Hi Andrei, thank you for your offer but I’m still working local so I don’t have a link to send you…
Do you mind looking at my code for a second?
This is my form:
[code] var myForm, formData;
function doOnLoad() {
formData = [{type: “calendar”, dateFormat: “%d-%m-%Y %H:%i”, value: “13-06-2012 11:35”, name: “mattinoDa”, label: “Mattino Da:”, enableTime: true, calendarPosition: “right”},
{type: “newcolumn”},
{type: “calendar”, name: “Mattino A:”, label: “mattinoA”, value: “02-10-2012 10:05”, enableTime: true, dateFormat: “%d-%m-%Y %H:%i”, calendarPosition: “right”},
{type: “combo”, label: “Trasporto”, name: “trasporto”, value: “”, inputWidth: 150, filtering: true, connector:“php/combo_trasporto.php”},
{type: “newcolumn”},
{type: “combo”, label: “Lavorazione”, name: “lavorazione”, value: “”, inputWidth: 150, filtering: true, connector:“php/combo_lavorazione.php”},
{type: “button”, name: “send”, value: “submit”}
];
myForm = new dhtmlXForm(“myForm”, formData);
myForm.attachEvent("onButtonClick", function(name) {
if (name == "send") {
myForm.send("php/save_data.php","post",function(xml){
alert("Saved!");
});
}
});
}
[/code]
and this should add a record to a table:
[code] $mattinoDa = $_POST[‘mattinoDa’];
$mattinoA = $_POST[‘mattinoA’];
$lavorazione = $_POST[‘lavorazione’];
$trasporto = $_POST[‘trasporto’];
$conn=mysql_connect(“localhost”,“root”,"");
mysql_select_db(“marcatempo”,$conn);
$sql = “INSERT INTO tabella_ore
(DataInizio, DataFine, IdLavorazione, IdTrasporto) VALUES (”.
“CONVERT(” . mattinoDa . ", DATETIME), " .
“CONVERT(” . mattinoA . ", DATETIME), " .
lavorazione . ", " .
trasporto . “)”;
mysql_query($sql);
exit();
[/code]
Can you see anything that’'s wrong?
Thanks a lot for your time!
Marco
Hi
sorry it not enough. can you collect all files and attach completed demo?
Hello Andrei,
thank you very much for your offer!
I’m happy to say that you were right all along! There were errors in the script I was calling…
I’m a newbie using mysql and did not know you needed quotes on field names…
I finally got to run FirePHP (great utility), found all my errors, and now everything is starting to work!
Thanks again for your support!
Marco