Antwort
 
LinkBack Themen-Optionen Thema bewerten Ansicht
  #1  
Alt 21.09.08, 17:47
Forum Newbie
 
Registriert seit: 18.09.08
Alter: 24
Beiträge: 22

Probleme mit erster Extension


Hi Zusammen,

habe meine erste Extension erstellt und funktioniert auch so weit.
Jetzt habe ich aber doch ein Problem, in der main function ertstelle
ich ein Formular, als Action habe ich $PHP_SELF, das mach es auch.
Nun würde ich gerne eine andere Funktion aufrufen, also die Daten des Form speichern in der DB. Dazu wollte ich in der main function einfach eine
if bedingung setzten. Also erster Aufruf Form bauen, zweiter Aufruf - get Variable abfangen und dann die functionen der bedingung.

Hier der Code meiner Extension:
PHP-Code:
<?php



/***************************************************************
*  Copyright notice
*
*  (c) 2008 Markus Miederer <mm@profoundmedia.de>
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

require_once(PATH_tslib.'class.tslib_pibase.php');


/**
 * Plugin 'Berater_Register' for the 'berater_register' extension.
 *
 * @author    Markus Miederer <mm@profoundmedia.de>
 * @package    TYPO3
 * @subpackage    tx_beraterregister
 */
class tx_beraterregister_pi1 extends tslib_pibase {



    var 
$prefixId      'tx_beraterregister_pi1';        // Same as class name
    
var $scriptRelPath 'pi1/class.tx_beraterregister_pi1.php';    // Path to this script relative to the extension dir.
    
var $extKey        'berater_register';    // The extension key.
    
var $pi_checkCHash true;
    
    
/**
     * The main method of the PlugIn
     *
     * @param    string        $content: The PlugIn content
     * @param    array        $conf: The PlugIn configuration
     * @return    The content that is displayed on the website
     */
     
     
function main($content,$conf)    {

         
     
        
$this->conf=$conf;
        
$this->pi_setPiVarDefaults();
        
$this->pi_loadLL();
        
        
        if (
$HTTP_GET_VARS['test'] == 'hallo'){
        
$content 'auswerten';



return 
$this->pi_wrapInBaseClass($content);
} if (
$HTTP_GET_VARS['test'] != 'hallo')

{
        
    
$content .= $HTTP_GET_VARS['test'];    
    
        
$content .= '
        
        
<script type="text/javascript">
function chkFormular () {


  if (document.Formular.Vorname.value == "") {
    alert("Bitte Ihren Vorname eingeben!");
    document.Formular.Vorname.focus();
    return false;
  }
    if (document.Formular.Nachname.value == "") {
    alert("Bitte Ihren Nachname eingeben!");
    document.Formular.Nachname.focus();
    return false;
  }
  
   if (document.Formular.Geburtsdatum.value == "") {
    alert("Bitte Ihr Geburtsdatum eingeben!");
    document.Formular.Geburtsdatum.focus();
    return false;
  }
  
    var chkZ = 1;
  for (i = 0; i < document.Formular.Geburtsdatum.value.length; ++i)
    if (document.Formular.Geburtsdatum.value.charAt(i) < "0" ||
        document.Formular.Geburtsdatum.value.charAt(i) > "9")
      chkZ = -1;
  if (chkZ == -1) {
    alert("Geburtsdatum keine Zahl!");
    document.Formular.Geburtsdatum.focus();
    return false;
  }
  
      var chkZ = 1;
  for (i = 0; i < document.Formular.PLZ.value.length; ++i)
    if (document.Formular.PLZ.value.charAt(i) < "0" ||
        document.Formular.PLZ.value.charAt(i) > "9")
      chkZ = -1;
  if (chkZ == -1) {
    alert("PLZ keine Zahl!");
    document.Formular.PLZ.focus();
    return false;
  }





  if (document.Formular.Mail.value == "") {
    alert("Bitte Ihre E-Mail-Adresse eingeben!");
    document.Formular.Mail.focus();
    return false;
  }
  if (document.Formular.Mail.value.indexOf("@") == -1) {
    alert("Keine E-Mail-Adresse!");
    document.Formular.Mail.focus();
    return false;
  }
  
  
    if (document.Formular.Telefon.value == "") {
    alert("Bitte Ihre Telefonnummer eingeben!");
    document.Formular.Telefon.focus();
    return false;
  }
  
     var chkZ = 1;
  for (i = 0; i < document.Formular.Telefon.value.length; ++i)
    if (document.Formular.Telefon.value.charAt(i) < "0" ||
        document.Formular.Telefon.value.charAt(i) > "9")
      chkZ = -1;
  if (chkZ == -1) {
    alert("Telefon keine Zahl!");
    document.Formular.Telefon.focus();
    return false;
  }
  
    if (document.Formular.Telefon2.value == "") {

    alert("Die wiederholen Sie Ihre Telefonummer!");
    document.Formular.Telefon2.focus();
    return false;
  }
  
 
  
        if (document.Formular.Strasse.value == "") {
    alert("Bitte Ihre Strasse eingeben!");
    document.Formular.Strasse.focus();
    return false;
  }
   
  
  
  if (document.Formular.PLZ.value == "") {
    alert("Bitte Ihren PLZ eingeben!");
    document.Formular.PLZ.focus();
    return false;
  }
  
 
  if (document.Formular.Ort.value == "") {
    alert("Bitte Ihr Ort eingeben!");
    document.Formular.Ort.focus();
    return false;
  }
 
    if (document.Formular.Telefon.value == "") {
    alert("Bitte Ihre Telefonnummer eingeben!");
    document.Formular.Telefon.focus();
    return false;
  }
  

    if (document.Formular.perso1.value == "") {
    alert("Bitte Alle Felder der Personalausweisnummer ausfüllen!");
    document.Formular.perso1.focus();
    return false;
  }
  
  
    if (document.Formular.perso2.value == "") {
    alert("Bitte Alle Felder der Personalausweisnummer ausfüllen!");
    document.Formular.perso2.focus();
    return false;
  }
  
       var chkZ = 1;
  for (i = 0; i < document.Formular.perso2.value.length; ++i)
    if (document.Formular.perso2.value.charAt(i) < "0" ||
        document.Formular.perso2.value.charAt(i) > "9")
      chkZ = -1;
  if (chkZ == -1) {
    alert("Nur Zahlen erlaubt!");
    document.Formular.perso2.focus();
    return false;
  }
  
  
  
    if (document.Formular.perso3.value == "") {
    alert("Bitte Alle Felder der Personalausweisnummer ausfüllen!");
    document.Formular.perso3.focus();
    return false;
  }
  
         var chkZ = 1;
  for (i = 0; i < document.Formular.perso3.value.length; ++i)
    if (document.Formular.perso3.value.charAt(i) < "0" ||
        document.Formular.perso3.value.charAt(i) > "9")
      chkZ = -1;
  if (chkZ == -1) {
    alert("Nur Zahlen erlaubt!");
    document.Formular.perso3.focus();
    return false;
  }
  
  
  
    if (document.Formular.perso4.value == "") {
    alert("Bitte Alle Felder der Personalausweisnummer ausfüllen!");
    document.Formular.perso4.focus();
    return false;
  }
  
         var chkZ = 1;
  for (i = 0; i < document.Formular.perso4.value.length; ++i)
    if (document.Formular.perso4.value.charAt(i) < "0" ||
        document.Formular.perso4.value.charAt(i) > "9")
      chkZ = -1;
  if (chkZ == -1) {
    alert("Nur Zahlen erlaubt!");
    document.Formular.perso4.focus();
    return false;
  }
  
  
  
 alert("Alle Daten ok, weiter zu Schritt2!");

}
</script>

        


   <form name="Formular" action="'
.$PHP_SELF.'" method="get" onsubmit="return chkFormular()">

        
    
  <input type="hidden" value="162" name="id"/>
    <input type="hidden" value="hallo" name="test"/>
    <input type="hidden" value="1" name="submitted"/>
    <input type="hidden" value="" name="L"/>
  

    

            
            
    
        
        
            
        
        <div class="subba_form" style="width: float: left;">
           <div class="formstyle">Anrede: *</div>
           <div class="formstyle2">

                <select maxlength="50" name="anrede">
                    <option value=""> </option>
                    <option value="Herr">Herr</option>
                    <option value="Frau">Frau</option>
                </select>
           </div>
        </div>

    

        <div class="subba_form" style="width: float: left;">
           <div class="formstyle">Vorname: *</div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="Vorname"/>
           </div>
        </div>

         <div class="subba_form" style="width: float: left;">
           <div class="formstyle">Nachname: *</div>

           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="Nachname"/>
           </div>


        </div>
        
        

        

        
        <div class="subba_form" style="width: float: left;">
           <div class="formstyle">Geburtsdatum (TT.MM.JJJJ:sad: *</div>

           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="Geburtsdatum"/>
           </div>
        </div>
        
        
            
        <div class="subba_form" style="width: float: left;">
           <div class="formstyle">eMail-Adresse: *</div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="Mail"/>

           </div>
        </div>
    
        <div class="subba_form" style="width: float: left;">
           <div class="formstyle">Telefonnummer: *</div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="30" name="Telefon"/>
           </div>
        </div>

        <div class="subba_form" style="width: float: left;">
           <div class="formstyle">Wiederholung Telefonnummer: *</div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="30" name="Telefon2"/>
           </div>
        </div>


        <div class="subba_form" style=" float: left;">

           <div class="formstyle">Straße, Nr.: *</div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="Strasse"/>
           </div>
        </div>

        <div class="subba_form" style=" float: left;">
           <div class="formstyle">PLZ, Ort: * </div>

           <div style="float: left; color: rgb(204, 8, 31);" class="formstyle2">
                <input type="text" value="" maxlength="5" name="PLZ" style="margin: 0pt 4px 10px 0pt; width: 50px;"/> 
                <input type="text" value="" maxlength="50" name="Ort" style="margin: 0pt 0pt 10px 4px; width: 200px;"/>
           </div>
        </div>
    
        <div class="subba_form" style=" float: left;">
           <div class="formstyle">Personalausweisnummer: * </div>
           <div style="float: left; color: rgb(204, 8, 31);" class="formstyle2">

                <input type="text" value="" maxlength="11" name="perso1" style="width: 65px; margin-right: 4px;"/><div class="subba_pfeil"><<</div>                  
                <input type="text" value="" maxlength="7" name="perso2" style="margin: 0pt 4px; width: 50px;"/><div class="subba_pfeil"><</div>
                <input type="text" value="" maxlength="7" name="perso3" style="margin: 0pt 4px; width: 50px;"/><div class="subba_pfeil"><</div>
                <input type="text" value="" maxlength="1" name="perso4" style="width: 21px; margin-left: 4px;"/>
           </div>
        </div>
    
        
        
        

    
        <div class="subba_form" style=" float: left;">

           <div class="formstyle">Gewerbeschein-Nummer:</div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="gewerbe"/>
           </div>
        </div>

        <div class="subba_form" style=" float: left;">
           <div class="formstyle">Steuernummer d. Gewerbes:</div>

           <div  class="formstyle2">
                <input type="text" value="" maxlength="50" name="steuer"/>

           </div>
        </div>

        <div class="subba_form" style=" float: left;">
           <div class="formstyle">USt-IdNr.: </div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="umsatz" class="short"/>

           </div>
        </div>
        
    

        
        <div class="formstyle5">
            Bankverbindung:
        </div>
    
    
        <div class="subba_form" style=" float: left;">

           <div class="formstyle">Kontonummer:</div>
           <div class="formstyle2">
                <input type="text" value="" maxlength="50" name="konto"/>
           </div>
        </div>

        <div class="subba_form" style=" float: left;">
           <div class="formstyle">Bankleitzahl:</div>

           <div  class="formstyle2">
                <input type="text" value="" maxlength="50" name="blz" class="short"/>
           </div>
        </div>
        
        <div class="formstyle5">
            Foto:
        </div>
        
            <div class="subba_form" style=" float: left;">
           <div class="formstyle">Foto hochladen:</div>



           <div class="formstyle2">
                <input type="file" value=""  name="bild" class="file_api"/>
           </div>
        </div>
        
         <div class="subba_button" style=" float: left; ">
          
               <input type="submit" size="35" value="abschicken" name="senden" class="button"/>
           
        </form></div>'
;
    
        return 
$this->pi_wrapInBaseClass($content);
    
}}


}





if (
defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/berater_register/pi1/class.tx_beraterregister_pi1.php'])    {



    include_once(
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/berater_register/pi1/class.tx_beraterregister_pi1.php']);
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
Mit Zitat antworten
  #2  
Alt 21.09.08, 23:31
Forum Newbie
 
Registriert seit: 18.09.08
Alter: 24
Beiträge: 22

Niemand eine idee bzw. Workaround wie ich das realisiere das
ich diese Script zur Verarbeitung aufrufe und dieses (das es zum zweiten mal aufgerufen wird abfange) und nicht das Form an ein Neues senden muss.

das ist mein letztes Problem dann wäre ich so gut wie fertig!
please help meeeee
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht Thema bewerten
Thema bewerten:

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Modern FAQ, erster Eintrag fehlerhaft scheibo Alle anderen Extensions 1 17.07.08 16:48
<title> unter <head> an erster Position ? saltletts TYPO3 4.x Fragen und Probleme 17 10.06.08 11:55
Gelöst wc_scriptaculous und erster Aufruf max50000 Alle anderen Extensions 1 20.11.07 21:51
GMENU wrap - erster Menüpunkt patrick1982a GMENU, HMENU, TMENU und Co. 1 03.09.07 09:30
Nur erster Record wird ausgegeben, wo liegt der Fehler? mstuebner Extension modifizieren oder neu erstellen 1 27.11.06 21:14


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:34 Uhr.


Powered by vBulletin® Version 3.7.3 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0