Formularüberprüfung erstellen

Grundsätzliche Themen zur Bedienung, Erstellung von Formularen, Datenbankanbindung und Beispiele ...
rok°!
Beiträge: 9
Registriert: 29.08.2007, 17:51

Formularüberprüfung erstellen

Beitrag von rok°! » 29.08.2007, 17:58

Hallo!
Ich habe ein Anmeldeformular zu realisieren, bei dem eine Prüfung der Eingaben vorgenommen werden soll.
Das Formular ist bereits erstellt.

Ich brauche momentan nur noch den Ansatz, wie ich die Felder - und vor allem wann (preSub?) - überprüfe. Hauptsächlich geht es darum ob Name, Str., PLZ, Ort überhaupt ausgefüllt wurden und ob _eine_ Kontaktadresse (Telefon und/oder E-Mail) angegeben wurde.
Habe mich heute den ganzen Tag mit dem LCD beschäftigt. Finde auch schon vieles, weiß aber nicht, wo ich ansetzen muss, damit ich da ne funktionierende Überprüfung hin bekomme.

Javascript ist kein Problem für mich.

Kann mir jemand helfen?
Danke schon mal im Voraus!
 
Gruß!

Benutzeravatar
Gentleman
Beiträge: 298
Registriert: 21.08.2007, 14:45

Formularüberprüfung erstellen

Beitrag von Gentleman » 29.08.2007, 18:41

Hi,

als erstes benutzt du zum Validieren das ereigniss validate oder exit...

in diesen ereignissen schreibst du dann den algorithmus...

beachte das der syntax bei LCD nicht normal wie bei JS ist obwohl du JS benutzt ;). Und außerdem stehen dir nur begrenzt funktionen von JS.

axo und am besten einen button benutzen ;) für die komplett validation oder so...
hier mal ein kleines beispiel

Code: Alles auswählen

 
----- topmostSubform.Page2.DruckenSchaltfläche1::click: - (JavaScript, Client) ---------------------

//=======================================================================Validierungs Variablen
var part1 = 0;
var Textfeld1 = 0;
var part2 = 0;
var liste = 0;
var part3 = 0;
var nummer = 0;
var part4 = 0;
var part5 = 0;
var part6 = 0;
var feld = 0;
var part8 = 0;
var part9 = 0;

//=======================================================================Validierung von Part1
if(Page1.part1.rawValue >= 1)
{    
    part1 = 1;
    Textfeld1 = 1;
    if((Page1.part1.rawValue==3) & ((Page1.Textfeld1.rawValue == null) | (Page1.Textfeld1.rawValue == " ")))
    {
        Textfeld1 = 0;
    }    
}
else
{
    part1 = 0;
}

//=======================================================================Validierung von Part2
if(Page1.part2.rawValue >= 1)
{    
    part2 = 1;
}
else
{
    part2 = 0;
}

//=======================================================================Validierung der DropdownListe
if(Page1.DropdownListe1.rawValue >= 1)
{
    liste = 1;
}
else
{
    liste = 0;
}

//=======================================================================Validierung von NumerischesFeld1
if(Page1.NumerischesFeld1.rawValue >= 0.5)
{
    nummer = 1;
}
else
{
    nummer = 0;
}

//=======================================================================Validierung von Part3
if(Page1.part3.rawValue == 1 & Page1.NumerischesFeld1.rawValue >= 20){    
    part3 = 1;
}else if(Page1.part3.rawValue == 2 & Page1.NumerischesFeld1.rawValue >= 3){    
    part3 = 1;
}else if(Page1.part3.rawValue == 3 & Page1.NumerischesFeld1.rawValue >= 1000000){    
    part3 = 1;
}else if(Page1.part3.rawValue == 4 & Page1.NumerischesFeld1.rawValue >= 0.5){    
    part3 = 1;
}
else
{
    part3 = 0;
}

//=======================================================================Validierung von Part4
if(Page1.part4.rawValue >= 1)
{
    part4 = 1;
}
else
{
    part4 = 0;
}
//=======================================================================Validierung von Part5
if(Page1.part5.rawValue >= 1)
{    
    if(Page1.part5.rawValue == 2)
    {
        if(Page1.part6.rawValue >= 1)
        {
            part6 = 1;
        }
        else
        {
            part6 = 0;
        }
    }
    part5 = 1;
    part6 = 1;    
}
else
{
    part5 = 0;
}
//=======================================================================Array Tabelle
var textArray = new Array();

textArray[0]  = Page2.TXTF1.rawValue;
textArray[1]  = Page2.TXTF2.rawValue;
textArray[2]  = Page2.TXTF3.rawValue;
textArray[3]  = Page2.TXTF4.rawValue;
textArray[4]  = Page2.TXTF5.rawValue;
textArray[5]  = Page2.TXTF6.rawValue;
textArray[6]  = Page2.TXTF7.rawValue;
textArray[7]  = Page2.TXTF8.rawValue;
textArray[8]  = Page2.TXTF9.rawValue;
textArray[9]  = Page2.TXTF10.rawValue;
textArray[10] = Page2.TXTF11.rawValue;
textArray[11] = Page2.TXTF12.rawValue;
textArray[12] = Page2.TXTF13.rawValue;
textArray[13] = Page2.TXTF14.rawValue;
textArray[14] = Page2.TXTF15.rawValue;
textArray[15] = Page2.TXTF16.rawValue;
textArray[16] = Page2.TXTF17.rawValue;
textArray[17] = Page2.TXTF18.rawValue;
textArray[18] = Page2.TXTF19.rawValue;
textArray[19] = Page2.TXTF20.rawValue;
textArray[20] = Page2.TXTF21.rawValue;
textArray[21] = Page2.TXTF22.rawValue;
textArray[22] = Page2.TXTF23.rawValue;
textArray[23] = Page2.TXTF24.rawValue;

//=======================================================================Validation der Tagbelle
if(Page1.DropdownListe1.rawValue == 1)
{    
    if(textArray[0] != null | textArray[0] != " " & textArray[1] != null | textArray[1] != " ")
    {
        part8 = 1;
    }
    else
    {
        part8 = 0;
    }
}

if(Page1.DropdownListe1.rawValue == 2)
{
    if(textArray[0] != null | textArray[0] != " " & textArray[1] != null | textArray[1] != " " & textArray[2] != null | textArray[2] != " " & textArray[3] != null | textArray[3] != " ")    
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}

if(Page1.DropdownListe1.rawValue == 3)
{
    if(textArray[0] != null | textArray[0] != " " & textArray[1] != null | textArray[1] != " " & textArray[2]  != null | textArray[2] != " " & textArray[3] != null | textArray[3] != " " & textArray[4] != null | textArray[4] != " " & textArray[5] != null | textArray[5] != " ")    
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 4)
{
    if(textArray[0] != null | textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null & textArray[7] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 5)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 6)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " " & textArray[10] != null |textArray[10] != " " & textArray[11] != null |textArray[11] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 7)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " " & textArray[10] != null |textArray[10] != " " & textArray[11] != null |textArray[11] != " " & textArray[12] != null |textArray[12] != " " & textArray[13] != null |textArray[13] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 8)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " " & textArray[10] != null |textArray[10] != " " & textArray[11] != null |textArray[11] != " " & textArray[12] != null |textArray[12] != " " & textArray[13] != null |textArray[13] != " " & textArray[14] != null |textArray[14] != " " & textArray[15] != null |textArray[15] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 9)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " " & textArray[10] != null |textArray[10] != " " & textArray[11] != null |textArray[11] != " " & textArray[12] != null |textArray[12] != " " & textArray[13] != null |textArray[13] != " " & textArray[14] != null |textArray[14] != " " & textArray[15] != null |textArray[15] != " " & textArray[16] != null |textArray[16] != " " & textArray[17] != null |textArray[17] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 10)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " " & textArray[10] != null |textArray[10] != " " & textArray[11] != null |textArray[11] != " " & textArray[12] != null |textArray[12] != " " & textArray[13] != null |textArray[13] != " " & textArray[14] != null |textArray[14] != " " & textArray[15] != null |textArray[15] != " " & textArray[16] != null |textArray[16] != " " & textArray[17] != null |textArray[17] != " " & textArray[18] != null |textArray[18] != " " & textArray[19] != null |textArray[19] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 11)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " " & textArray[10] != null |textArray[10] != " " & textArray[11] != null |textArray[11] != " " & textArray[12] != null |textArray[12] != " " & textArray[13] != null |textArray[13] != " " & textArray[14] != null |textArray[14] != " " & textArray[15] != null |textArray[15] != " " & textArray[16] != null |textArray[16] != " " & textArray[17] != null |textArray[17] != " " & textArray[18] != null |textArray[18] != " " & textArray[19] != null |textArray[19] != " " & textArray[20] != null |textArray[20] != " " & textArray[21] != null |textArray[21] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}
if(Page1.DropdownListe1.rawValue == 12)
{
    if(textArray[0] != null |textArray[0] != " " & textArray[1] != null |textArray[1] != " " & textArray[2]  != null |textArray[2] != " " & textArray[3] != null |textArray[3] != " " & textArray[4] != null |textArray[4] != " " & textArray[5] != null |textArray[5] != " " & textArray[6] != null |textArray[6] != " " & textArray[7] != null |textArray[7] != " " & textArray[8] != null |textArray[8] != " " & textArray[9] != null |textArray[9] != " " & textArray[10] != null |textArray[10] != " " & textArray[11] != null |textArray[11] != " " & textArray[12] != null |textArray[12] != " " & textArray[13] != null |textArray[13] != " " & textArray[14] != null |textArray[14] != " " & textArray[15] != null |textArray[15] != " " & textArray[16] != null |textArray[16] != " " & textArray[17] != null |textArray[17] != " " & textArray[18] != null |textArray[18] != " " & textArray[19] != null |textArray[19] != " " & textArray[20] != null |textArray[20] != " " & textArray[21] != null |textArray[21] != " " & textArray[22] != null |textArray[22] != " " & textArray[23] != null |textArray[23] != " ")
    {
        part8 = 1;
    }    
    else
    {
        part8 = 0;
    }
}

//=======================================================================Teaxtfeld0 Validierung
if((Page2.Textfeld0.rawValue == null) | (Page2.Textfeld0.rawValue == " "))
{
    feld = 0;
} 
else
{
    feld = 1;
}

//=======================================================================Adress Felder Validierung
if(Page2.Textfeld1.rawValue == null | Page2.Textfeld1.rawValue == " " & Page2.Textfeld2.rawValue == null | Page2.Textfeld2.rawValue == " " & Page2.Textfeld3.rawValue == null | Page2.Textfeld3.rawValue == " " & Page2.Textfeld4.rawValue == null | Page2.Textfeld4.rawValue == " " & Page2.Textfeld5.rawValue == null | Page2.Textfeld5.rawValue == " " & Page2.Textfeld6.rawValue == null | Page2.Textfeld6.rawValue == " " & Page2.Textfeld7.rawValue == null | Page2.Textfeld7.rawValue == " " & Page2.Textfeld8.rawValue == null | Page2.Textfeld8.rawValue == " " & Page2.Textfeld9.rawValue == null | Page2.Textfeld9.rawValue == " " & Page2.Textfeld10.rawValue == null | Page2.Textfeld10.rawValue == " " & Page2.Textfeld11.rawValue == null | Page2.Textfeld11.rawValue == " ")
{
    part9 = 0;
} 
else
{    
    part9 = 1;
}


//=======================================================================Komplett Validierung
if(    part1 == 1 & Textfeld1 == 1 & part2 == 1 & liste == 1 & part3 == 1 & nummer == 1 & part4 == 1 & part5 == 1 & part6 == 1 & feld == 1 & part8 == 1 & part9 == 1){
    app.alert("Part1: " + part1 + "  Textfeld: " + Textfeld1 + "  Part2: " + part2 + "  Liste: " + liste + "  Part3: " + part3 + "  Nummer: " + nummer + "  Part 4: " + part4 +"  Part5: " + part5 + "  Part6: " + part6 + "  Feld: " + feld + "  Part8: " + part8 + "  Part9: " + part9);
    Textfeld12.presence = "invisible";
    xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 1, 1, 0, 0, 0);
}
else{
    app.alert("Part1: " + part1 + "  Textfeld: " + Textfeld1 + "  Part2: " + part2 + "  Liste: " + liste + "  Part3: " + part3 + "  Nummer: " + nummer + "  Part 4: " + part4 +"  Part5: " + part5 + "  Part6: " + part6 + "  Feld: " + feld + "  Part8: " + part8 + "  Part9: " + part9);
    Textfeld12.presence = "visible";
    Textfeld12.presence = " ";
    Textfeld12.border.edge.color.value = "168,6,40";
    Textfeld12.rawValue = " Please Check your data input!";
}


[code]

rok°!
Beiträge: 9
Registriert: 29.08.2007, 17:51

Formularüberprüfung erstellen

Beitrag von rok°! » 29.08.2007, 19:01

Ah, ok. Bisher etwas umfangreich :) Das kommt aber sicher durch die Dropdown-Boxen.

Ich sehe keine Ausgabemeldungen ala "E-Mail Adresse fehlt". Wie wird dass denn realisisert?


Ich nutze einen E-Mail Sendebutton. Kann das Senden im Fehlerfall abgebrochen werden?

Benutzeravatar
Gentleman
Beiträge: 298
Registriert: 21.08.2007, 14:45

Formularüberprüfung erstellen

Beitrag von Gentleman » 30.08.2007, 08:59

Du kannst LCD die Formulate nicht versenden jedenfalls nicht das PDF Formular. Er versendet die Metadaten im form einer XML Datei...

Und zu deiner frage du mußt einfach einen E-Mail Button nehmen in das Ereigniss Click gehen... Und da kannst du ja deine Validation machen...

Um Ausgabefelder zu machen, benutzt du ganz einfach Textfelder die keinen Border haben und läßt dort die Fehler meldungen erscheinen.

Eigentlich ganz simpel und ganz einfach ;)

rok°!
Beiträge: 9
Registriert: 29.08.2007, 17:51

Formularüberprüfung erstellen

Beitrag von rok°! » 30.08.2007, 09:27

Schon klar, das die Daten per XML versendet werden, möchte ich ja. Das 3MB große PDF zurück senden zu lassen wäre arg böse :)

Einen E-Mail Button habe ich bereits angelegt - das versenden klappt ja.
Allerdings kann ich nicht in die Eigenschaft "Click", da diese deaktiviert ist.

Außerdem darf nicht versendet werden, wenn eine Bedingung falsch ist. Wie kann ich das Versenden denn abbrechen?

So wie ich das heraus gefunden habe, kann man auch mittels arg.alert("meldung!", 3) ein Info-Popup generieren, welches dann "meldung!" aus gibt.

Benutzeravatar
Gentleman
Beiträge: 298
Registriert: 21.08.2007, 14:45

Formularüberprüfung erstellen

Beitrag von Gentleman » 30.08.2007, 10:01

Ich habe doch gesagt IF Anweisung...

Code: Alles auswählen

<field name="EMailSendenSchaltfläche1" y="286.0308mm" x="139.3582mm" w="34.925mm" h="6mm">
            <?templateDesigner isEmailSubmitObject true?>
            <ui>
               <button/>
            </ui>
            <font typeface="Myriad Pro"/>
            <caption>
               <value>
                  <text>Per E-Mail senden</text>
               </value>
               <para hAlign="center" vAlign="middle"/>
               <font typeface="Myriad Pro"/>
            </caption>
            <border hand="right">
               <?templateDesigner StyleID apbx2?>
               <edge stroke="raised" cap="butt"/>
               <fill>
                  <color value="212,208,200"/>
               </fill>
            </border>
            <bind match="none"/>
            <event activity="click">
               <submit format="xml" textEncoding="UTF-8" target="mailto:fdfsfsdf@dsfdsf.de?subject=fsdfsdfsdfdfsdfsdf"/>
            </event>
         </field>
 
Das ist deine XML Anweisung...

Unter:

Code: Alles auswählen

<event activity="click">
               <submit format="xml" textEncoding="UTF-8" target="mailto:fdfsfsdf@dsfdsf.de?subject=fsdfsdfsdfdfsdfsdf"/>
            </event>
Ist deine Anweisung

In dem Tree schreibst du einfach:

Code: Alles auswählen

<script contentType="application/x-javascript">
Das sieht dannach so aus:

Code: Alles auswählen

<event activity="click">
               <submit format="xml" textEncoding="UTF-8" target="mailto:fdfsfsdf@dsfdsf.de?subject=fsdfsdfsdfdfsdfsdf"/>
<script contentType="application/x-javascript">
    if(sdkjfskdlfjasdöklfjdasfödsölf)<<<<deine IF Anweisung
</script>
             </event>
Wie du Obejcte Refernzierst ist doch hoffentlich klar  :D. So genauer kann ich es dir nicht mehr erklären.

rok°!
Beiträge: 9
Registriert: 29.08.2007, 17:51

Formularüberprüfung erstellen

Beitrag von rok°! » 30.08.2007, 10:09

So wie ich des sehe reden wir komplett aneinander vorbei.

Was hat es jetzt mit dem von dir geposteten XML-Code auf sich?

Benutzeravatar
Gentleman
Beiträge: 298
Registriert: 21.08.2007, 14:45

Formularüberprüfung erstellen

Beitrag von Gentleman » 30.08.2007, 11:12

Hmm,

dein LCD PDF basiert auf einer XML Datei...
Du hast beim LCD auch verschiedene ansichten...
einmal
  1. Designasicht
  2. XML Quelle
  3. Master
  4. Vorschau
Und wenn du mal auf XML Quelle schaust siehst du den Source Code von deiner PDF.
Wenn mal was nicht mitm Designe funktioniert probier es einfach mal in der XML ansicht da kann man ziemlich viele sachen verändern.

Wobei ich sagen muß das ich Lösung dort oben noch nicht ausprobiert habe :P. Dafür bist du dann zuständig ;). Wenn es nicht klappen sollte überleg ich mir eine andere Lösung!!!!

Ein tipp:
[fontsize=3]MACH ALLE TUTORIAL'S VON LCD!!!![/fontsize]

rok°!
Beiträge: 9
Registriert: 29.08.2007, 17:51

Formularüberprüfung erstellen

Beitrag von rok°! » 30.08.2007, 13:02

Ja, prima. Aber auf mein Problem/Fragenstellung bist du nicht näher eingegangen, sondern hast einfach was anderes geschrieben. Deswegen war ich verwirrt.


Was mich im Grunde interessiert - und darauf wurde bisher nicht eingegangen, oder ich war zu blöd das zu verstehen - ist, wie und an welcher Stelle überprüfe ich die Formulareingaben? Und vor allem: wie läuft die Fehlerbehandlung?

Das ich das mit einer if-Anweisung prüfe ist mir klar. Nur wie und bei welchem Ereigniss?

Bsp1:
Feld "Vorname" soll mindestens 2 und maximal 100 Zeichen haben

Bsp2:
Feld "Telefon" oder Feld "Email" soll ausgefüllt sein

An welcher Stelle überprüfe ich das? Wie kann ich dem "Ausfüller" mitteilen, dass meine Bedingungen nicht erfüllt wurden?
Das PDF / die Daten dürfen erst versendet werden, wenn alle Bedingungen "true" sind.

BTW: Generell ist es nicht möglich bei "Senden"-Schaltflächen das Ereignis "Click" zu verwenden.

PS: Ich kann auch kleine Schrift lesen ;)

rok°!
Beiträge: 9
Registriert: 29.08.2007, 17:51

Formularüberprüfung erstellen

Beitrag von rok°! » 31.08.2007, 14:18

Ich habe mal mit Gentlemans Hilfe eine Beispiel-PDF gebaut. Die Formularüberprüfung klappt ohne Probleme, leider wird das Formular trotzdem versendet, wenn sie fehl schlägt.

Weiß jemand weiter?
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.

Antworten