| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer User Registriert seit: May 2003
Beiträge: 26
| Fehler im Skript für das Mailformular
Hallo, wer kann mir helfen? Sobald ein User ein "." in der eigenen Emailadresse angibt, und dann auf senden klickt, bekommt er eine Fehlermeldung das er das Formular richtig ausfüllen soll. Wie kann ich das abstellen? Hier das Skript: (habe ich auch irgendwo hier in dem Forum gefunden) Vielen Dank Gruß Xorron Code: ///////////////////////////////////////////////////////////////////////////////
//
var txtFeldArr:Array = ["txtName", "txtVorname", "txtStrasse", "txtOrt", "txtTel", "txtMobil", "txtEmail", "txtMessage"];
var txtLabelArr:Array = ["Name", "Vorname", "Straße", "PLZ/Ort", "Telefon", "Mobil", "Email", "Bitte teilen Sie uns Ihre Fragen mit"];
var pflichtFelderArr:Array = [txtFeldArr[0], txtFeldArr[1], txtFeldArr[4], txtFeldArr[6], txtFeldArr[8]];
//
///////////////////////////////////////////////////////////////////////////////
//
TextField.prototype.setOldContent = function() {
this.text = txtLabelArr[this.i];
};
//----------------------------------------------------------------------------
TextField.prototype.setOldTxtStyle = function() {
this.border = true;
this.background = true;
this.textColor = "0x777777";
this.borderColor = "0xAAAAAA";
this.backgroundColor = "0xFFFFFF";
};
//----------------------------------------------------------------------------
TextField.prototype.setNewTxtStyle = function() {
this.border = true;
this.background = true;
this.textColor = "0x000000";
this.borderColor = "0x003399";
this.backgroundColor = "0xcccccc";
};
//----------------------------------------------------------------------------
TextField.prototype.setFalseStyle = function() {
this.border = true;
this.background = true;
this.textColor = "0xFFFFFF";
this.borderColor = "0xFF0000";
this.backgroundColor = "0xFF0000";
};
//----------------------------------------------------------------------------
TextField.prototype.checkForOldContent = function() {
if (this.text == txtLabelArr[this.i]) {
return true;
}
};
// ---------------------------------------------------------------------------
TextField.prototype.checkIfEmpty = function() {
if (this.text == "") {
return true;
}
};
//
///////////////////////////////////////////////////////////////////////////////
//
fncInit = function () {
mcFormular.txtStatus.textColor = "0xFF0000";
mcFormular.txtStatus.text = "";
// ----------------------------------------------------------
for (i=0; i<txtFeldArr.length; i++) {
mcFormular[txtFeldArr[i]].text = txtLabelArr[i];
mcFormular[txtFeldArr[i]].tabIndex = i+1;
mcFormular[txtFeldArr[i]].setOldTxtStyle();
mcFormular[txtFeldArr[i]].i = i;
// ------------------------------------------------------
mcFormular[txtFeldArr[i]].onSetFocus = function() {
this.setNewTxtStyle();
if (this.checkForOldContent()) {
this.text = "";
}
};
// ------------------------------------------------------
mcFormular[txtFeldArr[i]].onKillFocus = function() {
this.setOldTxtStyle();
if (this.checkIfEmpty()) {
this.setOldContent();
}
};
}
// ----------------------------------------------------------
mcFormular.btnClear.onRelease = function() {
this.txtLabel._x = this.txtLabel._y -= 1;
fncInit();
};
mcFormular.btnSend.onRelease = function() {
this.txtLabel._x = this.txtLabel._y -= 1;
fncSend(mcFormular);
};
};
//
///////////////////////////////////////////////////////////////////////////////
//
fncSend = function (mc) {
var felderVoll:Boolean = false;
var trueEmail:Boolean = false;
for (i=0; i<pflichtFelderArr.length; i++) {
if ((mc[pflichtFelderArr[i]].text == "") || (mc[pflichtFelderArr[i]].text == txtLabelArr[i])) {
mc[pflichtFelderArr[i]].setFalseStyle();
mc.txtStatus.text = "Bitte füllen Sie alle Felder korrekt aus!";
felderVoll = false;
} else {
felderVoll = true;
}
// --------------------------------------------------------------------
if(pflichtFelderArr[i] == "txtEmail"){
if ((mc[pflichtFelderArr[i]].text.indexOf("@")<2) || (mc[pflichtFelderArr[i]].text.indexOf(".")<5)) {
mc[pflichtFelderArr[i]].setFalseStyle();
mc.txtStatus.text = "Bitte füllen Sie alle Felder korrekt aus!";
trueEmail = false;
} else {
trueEmail = true;
}
}
}
// ------------------------------------------------------------------------
if ((felderVoll == true) && (trueEmail == true)) {
var receiveData:LoadVars = new LoadVars();
receiveData.onLoad = function(success) {
getURL("javascript:alert('PHP GELADEN')");
if (success) {
if (receiveData.infoOk) {
getURL("javascript:alert('OK: EMAIL GESENDET')");
mc.txtStatus.textColor = "0x00CC00";
mc.txtStatus.text = "Daten wurden erfolgreich gesendet";
delete receiveData;
delete sendData;
} else {
getURL("javascript:alert('FEHLER: EMAIL NICHT GESENDET')");
mc.txtStatus.textColor = "0xFF0000";
mc.txtStatus.text = "Daten konnten leider nicht gesendet werden!";
}
}
};
//
var sendData:LoadVars = new LoadVars();
for (var i = 0; i<txtFeldArr.length; i++) {
sendData[txtFeldArr[i]] = mc[txtFeldArr[i]].text;
}
//
sendData.sendAndLoad("flashMail.php", receiveData, "POST");
mc.txtStatus.textColor = "0xFF0000";
mc.txtStatus.text = "Daten werden gesendet ...";
//
restartInt = setInterval(function(){
clearInterval(restartInt);
fncInit();
}, 4000);
}
};
//
///////////////////////////////////////////////////////////////////////////////
//
mcFormular.btnClear.txtLabel.text = "löschen";
mcFormular.btnSend.txtLabel.text = "senden";
mcFormular.btnClear.txtLabel.textColor = "0x000000";
mcFormular.btnSend.txtLabel.textColor = "0x000000";
//----------------------------------------------------------------------------
mcFormular.btnClear.onRollOver = mcFormular.btnSend.onRollOver=function () {
this.txtLabel.textColor = "0xFFFFFF";
};
mcFormular.btnClear.onRollOut = mcFormular.btnSend.onRollOut=function () {
this.txtLabel.textColor = "0x000000";
};
//----------------------------------------------------------------------------
mcFormular.btnClear.onPress = mcFormular.btnSend.onPress=function () {
this.txtLabel._x = this.txtLabel._y += 1;
};
mcFormular.btnClear.onReleaseOutside = mcFormular.btnSend.onReleaseOutside=function () {
this.txtLabel.textColor = "0x000000";
this.txtLabel._x = this.txtLabel._y -= 1;
};
//
///////////////////////////////////////////////////////////////////////////////
//
fncInit(); |
| | |
| | #3 (permalink) |
| Neuer User Registriert seit: May 2003
Beiträge: 26
|
Danke für den Tipp, leider geht es immer noch nicht, ich bekomme immer noch die Meldung: "Bitte füllen Sie alle Felder korrekt aus". Woran kann es noch liegen? Hier nochmal der aktuelle, veränderte Code: Code: ///////////////////////////////////////////////////////////////////////////////
//
var txtFeldArr:Array = ["txtName", "txtVorname", "txtStrasse", "txtOrt", "txtTel", "txtMobil", "txtEmail", "txtMessage"];
var txtLabelArr:Array = ["Name", "Vorname", "Straße", "PLZ/Ort", "Telefon", "Mobil", "Email", "Bitte teilen Sie uns Ihre Fragen mit."];
var pflichtFelderArr:Array = [txtFeldArr[0], txtFeldArr[1], txtFeldArr[4], txtFeldArr[6], txtFeldArr[8]];
//
///////////////////////////////////////////////////////////////////////////////
//
TextField.prototype.setOldContent = function() {
this.text = txtLabelArr[this.i];
};
//----------------------------------------------------------------------------
TextField.prototype.setOldTxtStyle = function() {
this.border = true;
this.background = true;
this.textColor = "0x777777";
this.borderColor = "0xAAAAAA";
this.backgroundColor = "0xFFFFFF";
};
//----------------------------------------------------------------------------
TextField.prototype.setNewTxtStyle = function() {
this.border = true;
this.background = true;
this.textColor = "0x000000";
this.borderColor = "0x003399";
this.backgroundColor = "0xcccccc";
};
//----------------------------------------------------------------------------
TextField.prototype.setFalseStyle = function() {
this.border = true;
this.background = true;
this.textColor = "0xFFFFFF";
this.borderColor = "0xFF0000";
this.backgroundColor = "0xFF0000";
};
//----------------------------------------------------------------------------
TextField.prototype.checkForOldContent = function() {
if (this.text == txtLabelArr[this.i]) {
return true;
}
};
// ---------------------------------------------------------------------------
TextField.prototype.checkIfEmpty = function() {
if (this.text == "") {
return true;
}
};
//
///////////////////////////////////////////////////////////////////////////////
//
fncInit = function () {
mcFormular.txtStatus.textColor = "0xFF0000";
mcFormular.txtStatus.text = "";
// ----------------------------------------------------------
for (i=0; i<txtFeldArr.length; i++) {
mcFormular[txtFeldArr[i]].text = txtLabelArr[i];
mcFormular[txtFeldArr[i]].tabIndex = i+1;
mcFormular[txtFeldArr[i]].setOldTxtStyle();
mcFormular[txtFeldArr[i]].i = i;
// ------------------------------------------------------
mcFormular[txtFeldArr[i]].onSetFocus = function() {
this.setNewTxtStyle();
if (this.checkForOldContent()) {
this.text = "";
}
};
// ------------------------------------------------------
mcFormular[txtFeldArr[i]].onKillFocus = function() {
this.setOldTxtStyle();
if (this.checkIfEmpty()) {
this.setOldContent();
}
};
}
// ----------------------------------------------------------
mcFormular.btnClear.onRelease = function() {
this.txtLabel._x = this.txtLabel._y -= 1;
fncInit();
};
mcFormular.btnSend.onRelease = function() {
this.txtLabel._x = this.txtLabel._y -= 1;
fncSend(mcFormular);
};
};
//
///////////////////////////////////////////////////////////////////////////////
//
fncSend = function (mc) {
var felderVoll:Boolean = false;
var trueEmail:Boolean = false;
for (i=0; i<pflichtFelderArr.length; i++) {
if ((mc[pflichtFelderArr[i]].text == "") || (mc[pflichtFelderArr[i]].text == txtLabelArr[i])) {
mc[pflichtFelderArr[i]].setFalseStyle();
mc.txtStatus.text = "Bitte füllen Sie alle Felder korrekt aus!";
felderVoll = false;
} else {
felderVoll = true;
}
// --------------------------------------------------------------------
if(pflichtFelderArr[i] == "txtEmail"){
if ((mc[pflichtFelderArr[i]].text.indexOf("@")<2)) {
mc[pflichtFelderArr[i]].setFalseStyle();
mc.txtStatus.text = "Bitte füllen Sie alle Felder korrekt aus!";
trueEmail = false;
} else {
trueEmail = true;
}
}
}
// ------------------------------------------------------------------------
if ((felderVoll == true) && (trueEmail == true)) {
var receiveData:LoadVars = new LoadVars();
receiveData.onLoad = function(success) {
getURL("javascript:alert('PHP GELADEN')");
if (success) {
if (receiveData.infoOk) {
getURL("javascript:alert('OK: EMAIL GESENDET')");
mc.txtStatus.textColor = "0x00CC00";
mc.txtStatus.text = "Daten wurden erfolgreich gesendet";
delete receiveData;
delete sendData;
} else {
getURL("javascript:alert('FEHLER: EMAIL NICHT GESENDET')");
mc.txtStatus.textColor = "0xFF0000";
mc.txtStatus.text = "Daten konnten leider nicht gesendet werden!";
}
}
};
//
var sendData:LoadVars = new LoadVars();
for (var i = 0; i<txtFeldArr.length; i++) {
sendData[txtFeldArr[i]] = mc[txtFeldArr[i]].text;
}
//
sendData.sendAndLoad("flashMail.php", receiveData, "POST");
mc.txtStatus.textColor = "0xFF0000";
mc.txtStatus.text = "Daten werden gesendet ...";
//
restartInt = setInterval(function(){
clearInterval(restartInt);
fncInit();
}, 4000);
}
};
//
///////////////////////////////////////////////////////////////////////////////
//
mcFormular.btnClear.txtLabel.text = "löschen";
mcFormular.btnSend.txtLabel.text = "senden";
mcFormular.btnClear.txtLabel.textColor = "0x000000";
mcFormular.btnSend.txtLabel.textColor = "0x000000";
//----------------------------------------------------------------------------
mcFormular.btnClear.onRollOver = mcFormular.btnSend.onRollOver=function () {
this.txtLabel.textColor = "0xFFFFFF";
};
mcFormular.btnClear.onRollOut = mcFormular.btnSend.onRollOut=function () {
this.txtLabel.textColor = "0x000000";
};
//----------------------------------------------------------------------------
mcFormular.btnClear.onPress = mcFormular.btnSend.onPress=function () {
this.txtLabel._x = this.txtLabel._y += 1;
};
mcFormular.btnClear.onReleaseOutside = mcFormular.btnSend.onReleaseOutside=function () {
this.txtLabel.textColor = "0x000000";
this.txtLabel._x = this.txtLabel._y -= 1;
};
//
///////////////////////////////////////////////////////////////////////////////
//
fncInit(); Geändert von Xorron (24-04-2009 um 09:46 Uhr) |
| | |
![]() |
| Lesezeichen |
| Stichworte |
| formmailer, formular, mailer |
| Themen-Optionen | |
| Ansicht | |
| |