Drupal. Forms
Upcoming SlideShare
Loading in...5
×
 

Drupal. Forms

on

  • 120 views

 

Statistics

Views

Total Views
120
Views on SlideShare
115
Embed Views
5

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 5

http://drupalsib.ru 4
http://drupalsib.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Drupal. Forms Drupal. Forms Presentation Transcript

  • Drupal. Какая форма! Какая динамика! Крайнюк Михаил
  • <form method="POST" name="login" action="http://site/log"> <div> Email </div> <div> <input type="text" name="email"> </div> <div> Пароль </div> <div> <input type="password" name="pass"> </div> <input type="submit" class="submit"> </form>
  • Email MOYAPOCHTA@EXAMPLE.COM Пароль OOOOOO Submit
  • Проверка данных Если есть ошибки Иначе обработка данных
  • function name_my_form($form, &$form_state) { $form[‘email'] = array( '#type' => ‘textfield', '#title' => t(‘Email'), ); $form[‘password'] = array( '#type' => ‘password', '#title' => t(‘Пароль'), ); $form['submit'] = array( '#type' => 'submit', '#value' => t(‘Submit'), ); return $form; }
  • Email Пароль Submit
  • function name_my_form_validate($form, &$form_state) { $values = &$form_state[‘values’]; $email = $values[‘email’]; $password = $values[‘password’]; ... (проверка почты и пароля) ... if ($error) { form_error($form[‘email’], t(‘Некорректная почта!’)); } } function name_my_form_submit($form, $form_state) { ... (обработка данных) ... }
  • function mymodule_name_my_form_alter(&$form, &$form_state) { $form['submit']['#value‘] = t(‘Войти'); } Email Пароль Войти
  • ‘#states’ => array( ‘visible’ => ... ), ‘#ajax’ => array( ‘callback’ => ‘my_callback’, ‘wrapper’ => ‘id-of-my-wrapper’, ‘method’ => ‘replace’, ‘effect’ => ‘fade’, ), AJAX + $commands[] + Drupal.ajax.prototype...
  • Спасибо за внимание!