Changeset 202 for trunk/forms.php


Ignore:
Timestamp:
Apr 30, 2009, 11:30:37 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Při chybně vyplněném formuláři zobraz chybové hlášení i obsah formuláře, aby nebylo nutné vše vyplňovat znovu.
  • Přidáno: Možnost povolit v konfiguraci webu formátování výstupního HTML kódu.
  • Opraveno: Validace HTML kódu generování formulářů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forms.php

    r187 r202  
    99  var $Values = array();
    1010  var $OnSubmit = '';
    11 
     11 
    1212  function Form($ClassName)
    1313  { 
     
    1919  function ShowEditForm()
    2020  {
    21     $Output = '<form action="'.$this->OnSubmit.'" method="post"><center>'.$this->ShowEditBlock().'<input type="submit" value="Uložit"></center></form>';
     21    if(!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit';
     22    $Output = '<form class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock().'<div><input type="submit" value="'.$this->Definition['SubmitText'].'" /></div></form>';
    2223    return($Output);
    2324  }
     
    3940        case 'Boolean':
    4041          if($this->Values[$Index] == 0) $Checked = ''; else $Checked = ' CHECKED';
    41           $Edit = '<input type="checkbox" name="'.$Context.$Index.'"'.$Checked.'>';
     42          $Edit = '<input type="checkbox" name="'.$Context.$Index.'"'.$Checked.' />';
    4243          break;
    4344        case 'String':
    44           $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">';
    45           break;
    46         case 'Password':
    47           $Edit = '<input type="password" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">';
     45          $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />';
     46          break;
     47        case 'Password':
     48          $Edit = '<input type="password" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />';
    4849          break;
    4950        case 'Integer':
    50           $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">';
     51          $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />';
    5152          break;
    5253        case 'Float':
    53           $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">';
     54          $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />';
    5455          break;
    5556        case 'Time':
    5657          if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('j.n.Y');
    57           $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">';
     58          $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />';
    5859          break;
    5960        case 'Array':
     
    6970            "scr.parentNode.insertBefore(newcontent, scr); }".
    7071            '</script>';
    71             $Edit .= '<form><input type="button" onclick="AddItem();" value="Přidat položku"></form>';
     72            $Edit .= '<form><input type="button" onclick="AddItem();" value="Přidat položku" /></form>';
    7273          break;
    7374        default:
     
    101102      array_push($Table['Rows'], array($Item['Caption'].':', $Edit));
    102103    }
    103     $Output = '<fieldset style="width: 500px;"><legend>'.$this->Definition['Title'].'</legend>'.Table($Table).
     104    $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table).
    104105    '</fieldset>';
    105106    return($Output);
     
    166167    foreach($this->Definition['Items'] as $Index => $Item)
    167168    {
     169      if(array_key_exists($Context.$Index, $_POST))
    168170      switch($Item['Type'])
    169171      {
     
    227229{
    228230  $Result = '<table class="BasicTable">';
    229   $Result .= '<tr>';
    230231  if(array_key_exists('Header', $Table))
    231232  {
     233    $Result .= '<tr>';
    232234    foreach($Table['Header'] as $Item)
    233235      $Result .= '<th>'.$Item.'</th>';
Note: See TracChangeset for help on using the changeset viewer.