Więc tak oto skrypt:
Kod
function login_sms_clik() {
$('login_sms_error').update();
$('login_sms').update();
var login_sms = $F('login_sms');
advAJAX.post({
url: "loginsms.php",
parameters: {
"cmd": "ajaxLoginSms",
"login_sms" : login_sms
},
onSuccess : function(obj) {
if (obj.responseJSON.errors == true){
$('login_sms_error').update(obj.responseJSON.error_msgs.login_sms_error);
} else {
$('login_sms_step1').update(obj.responseJSON.html);
}
},
onError : function(obj) {
}
});
}
A to fragment loginsms.php
<?php if ($_REQUEST['cmd'] == 'ajaxLoginSms') { $smarty->assign('number',$number); $login_pass=$user->loginSMS($number); if($login_pass){ }else { $error_msgs['login_sms_error'] = \"Brak takiego numeru w bazie\"; } } //... { // zatrzymujemy na walidacji } else { // przechodzimy do następnego kroku $returnData = array('errors' => false, 'error_msgs' => null, 'html' =>$smarty->fetch('login_sms_step2.tpl')); } ?>
Błąd z konsoli błędów opery:
Kod
JavaScript - http://xxx.pl.local/
Event thread: click
Error:
name: TypeError
message: Statement on line 3485: Type mismatch (usually a non-object value used where an object is required)
Backtrace:
Line 3485 of linked script http://xxx.pl.local/js/prototype.js
return Form.Element.Serializers[method](element);
Line 1680 of linked script http://xxx.pl.local/js/actions.js
var login_sms = $F("login_sms");
Line 1 of script
login_sms_clik();
At unknown location
[statement source code not available]
Zamiast wstawić templatke badź wywalić błąd usuwa formularz i zostawia puste pole.
Nie zielonego dlaczego nie działa. Z gory dzięki za pomoc.
Problem rozwiazany dla potomności, nie nazywajcie pola formularza i formularza tak samo
