XOOPS Form Öğeleri
Genel Bakış
Section titled “Genel Bakış”XOOPS, XoopsFormElement sınıf hiyerarşisi aracılığıyla kapsamlı bir form öğeleri kümesi sağlar. Bu öğeler, web formları için oluşturma, doğrulama ve veri işleme işlemlerini gerçekleştirir.
Form Öğesi Hiyerarşisi
Section titled “Form Öğesi Hiyerarşisi”classDiagram class XoopsFormElement { +getName() +getCaption() +render() +setValue() +getValue() }
XoopsFormElement <|-- XoopsFormText XoopsFormElement <|-- XoopsFormTextArea XoopsFormElement <|-- XoopsFormSelect XoopsFormElement <|-- XoopsFormCheckBox XoopsFormElement <|-- XoopsFormRadio XoopsFormElement <|-- XoopsFormButton XoopsFormElement <|-- XoopsFormHidden XoopsFormElement <|-- XoopsFormFile XoopsFormElement <|-- XoopsFormLabel XoopsFormElement <|-- XoopsFormPassword XoopsFormElement <|-- XoopsFormDateTimeMetin Giriş Öğeleri
Section titled “Metin Giriş Öğeleri”XoopsFormText
Section titled “XoopsFormText”Tek satırlık metin girişi:
use XoopsFormText;
$element = new XoopsFormText( caption: 'Username', name: 'username', size: 30, maxlength: 50, value: $currentValue);XoopsFormPassword
Section titled “XoopsFormPassword”Maskeleme ile şifre girişi:
use XoopsFormPassword;
$element = new XoopsFormPassword( caption: 'Password', name: 'password', size: 30, maxlength: 100);XoopsFormTextArea
Section titled “XoopsFormTextArea”Çok satırlı metin girişi:
use XoopsFormTextArea;
$element = new XoopsFormTextArea( caption: 'Description', name: 'description', value: $currentValue, rows: 5, cols: 50);Seçim Öğeleri
Section titled “Seçim Öğeleri”XoopsFormSelect
Section titled “XoopsFormSelect”Açılan seçim:
use XoopsFormSelect;
$element = new XoopsFormSelect( caption: 'Category', name: 'category_id', value: $selected, size: 1, multiple: false);
$element->addOption(1, 'Category 1');$element->addOption(2, 'Category 2');$element->addOptionArray([ 3 => 'Category 3', 4 => 'Category 4']);XoopsFormCheckBox
Section titled “XoopsFormCheckBox”Onay kutusu girişi:
use XoopsFormCheckBox;
$element = new XoopsFormCheckBox( caption: 'Features', name: 'features', value: $selected);
$element->addOption('comments', 'Enable Comments');$element->addOption('ratings', 'Enable Ratings');XoopsFormRadio
Section titled “XoopsFormRadio”Radyo düğmesi grubu:
use XoopsFormRadio;
$element = new XoopsFormRadio( caption: 'Status', name: 'status', value: $currentValue);
$element->addOption('draft', 'Draft');$element->addOption('published', 'Published');$element->addOption('archived', 'Archived');Dosya Yükleme
Section titled “Dosya Yükleme”XoopsFormFile
Section titled “XoopsFormFile”Dosya yükleme girişi:
use XoopsFormFile;
$element = new XoopsFormFile( caption: 'Upload Image', name: 'image');
$element->setMaxFileSize(2 * 1024 * 1024); // 2MBTarih ve Saat
Section titled “Tarih ve Saat”XoopsFormDateTime
Section titled “XoopsFormDateTime”Date/time seçici:
use XoopsFormDateTime;
$element = new XoopsFormDateTime( caption: 'Publish Date', name: 'publish_date', size: 15, value: time());Özel Unsurlar
Section titled “Özel Unsurlar”XoopsFormHidden
Section titled “XoopsFormHidden”Gizli alan:
use XoopsFormHidden;
$element = new XoopsFormHidden('article_id', $articleId);XoopsFormLabel
Section titled “XoopsFormLabel”Salt görüntülü etiket:
use XoopsFormLabel;
$element = new XoopsFormLabel( caption: 'Created By', value: $authorName);XoopsFormButton
Section titled “XoopsFormButton”Form düğmeleri:
use XoopsFormButton;
// Submit button$submit = new XoopsFormButton('', 'submit', 'Save', 'submit');
// Reset button$reset = new XoopsFormButton('', 'reset', 'Reset', 'reset');Öğe Özelleştirmesi
Section titled “Öğe Özelleştirmesi”CSS Sınıfları Ekleme
Section titled “CSS Sınıfları Ekleme”$element->setExtra('class="form-control custom-class"');Özel Nitelikler Ekleme
Section titled “Özel Nitelikler Ekleme”$element->setExtra('data-validate="required" placeholder="Enter text..."');Ayar Açıklama
Section titled “Ayar Açıklama”$element->setDescription('Enter a unique username (3-20 characters)');İlgili Belgeler
Section titled “İlgili Belgeler”- Formlara Genel Bakış
- Form Doğrulama
- Özel Oluşturucular