Tworzenie formularzy (form generation)

Functions to enable the processing and display of HTML forms.

Drupal uses these functions to achieve consistency in its form processing and presentation, while simplifying code and reducing the amount of HTML that must be explicitly generated by modules.

The drupal_get_form() function handles retrieving and processing an HTML form for modules automatically. For example:

<?php

// Display the user registration form.
$output = drupal_get_form('user_register');

?>

Forms can also be built and submitted programmatically without any user input using the drupal_form_submit() function.

For information on the format of the structured arrays used to define forms, and more detailed explanations of the Form API workflow, see the reference and the quickstart guide.

Funkcje

NazwaLokalizacjaOpis
date_validateincludes/form.incSprawdza typ daty; zatrzymuje daty jak 30 styczeń 2006.
drupal_build_formincludes/form.incBuduje i przetwarza formularz na podstawie identyfikatora.
drupal_form_submitincludes/form.incRetrieves a form using a form_id, populates it with $form_state['values'], processes it, and returns any validation errors encountered. This function is the programmatic counterpart to drupal_get_form().
drupal_get_formincludes/form.incWrapper for drupal_build_form() for use when $form_state is not needed.
drupal_prepare_formincludes/form.incPrepares a structured form array by adding required elements, executing any hook_form_alter functions, and optionally inserting a validation token to prevent tampering.
drupal_process_formincludes/form.incTa funkcja jest sercem API formularzy. Tutaj formularz jest budowany, poddany walidacji i, w odpowiednich sytuacjach, dodany.
drupal_rebuild_formincludes/form.incPobiera formularz, cache'uje go oraz przetwarza z pustym $_POST.
drupal_redirect_formincludes/form.incPrzekierowuje użytkownika na podany adres po przetworzeniu formularza.
drupal_retrieve_formincludes/form.incOdzyskuje strukturalną tablicę, definiującą dany formularz.
drupal_validate_formincludes/form.incValidates user-submitted form data from the $form_state using the validate functions defined in a structured form array.
form_ahah_callbackincludes/form.incMenu callback for AHAH callbacks through the #ahah['callback'] FAPI property.
form_builderincludes/form.incWalk through the structured form array, adding any required properties to each element and mapping the incoming $_POST data to the proper elements. Also, execute any #process handlers attached to a specific element.
form_clean_idincludes/form.incPrepare an HTML ID attribute string for a form item.
form_errorincludes/form.incOznacz element jako posiadający błąd.
form_execute_handlersincludes/form.incA helper function used to execute custom validation and submission handlers for a given form. Button-specific handlers are checked first. If none exist, the function falls back to form-level handlers.
form_get_cacheincludes/form.incPobiera formularz z pamięci podręcznej.
form_get_errorincludes/form.incReturn the error message filed against the form with the specified name.
form_get_errorsincludes/form.incReturn an associative array of all errors.
form_get_optionsincludes/form.incTraverses a select element's #option array looking for any values that hold the given key. Returns an array of indexes that match.
form_pre_render_conditional_form_elementincludes/form.incAdd form_element theming to an element if title or desription is set.
form_pre_render_fieldsetincludes/form.incAdds members of this group as actual elements for rendering.
form_process_ahahincludes/form.incAdd AHAH information about a form element to the page to communicate with javascript. If #ahah[path] is set on an element, this additional javascript is added to the page header to attach the AHAH behaviors. See ahah.js for more information.
form_process_dateincludes/form.incRoll out a single date element.
form_process_fieldsetincludes/form.incAdds fieldsets to the specified group or adds group members to this fieldset.
form_process_password_confirmincludes/form.incExpand a password_confirm field into two text boxes.
form_process_radiosincludes/form.incRoll out a single radios element to a list of radios, using the options array as index.
form_process_tableselectincludes/form.incCreate the correct amount of checkbox or radio elements to populate the table.
form_process_text_formatincludes/form.incAdd text format selector to text elements with the #text_format property.
form_process_vertical_tabsincludes/form.incCreates a group formatted as vertical tabs.
form_process_weightincludes/form.incExpand weight elements into selects.
form_set_cacheincludes/form.incStore a form in the cache
form_set_errorincludes/form.incWysyła błąd dotyczący danego elementu formularza.
form_set_valueincludes/form.incChange submitted form values during the form processing cycle.
form_state_defaultsincludes/form.incRetrieve default values for the $form_state array.
form_type_checkboxes_valueincludes/form.incHelper function to determine the value for a checkboxes form element.
form_type_checkbox_valueincludes/form.incHelper function to determine the value for a checkbox form element.
form_type_image_button_valueincludes/form.incHelper function to determine the value for an image button form element.
form_type_password_confirm_valueincludes/form.incHelper function to determine the value for a password_confirm form element.
form_type_select_valueincludes/form.incHelper function to determine the value for a select form element.
form_type_textfield_valueincludes/form.incHelper function to determine the value for a textfield form element.
form_type_token_valueincludes/form.incHelper function to determine the value for form's token value.
map_monthincludes/form.incHelper function for usage with drupal_map_assoc to display month names.
password_confirm_validateincludes/form.incValidate password_confirm element.
theme_buttonincludes/form.incTheme a form button.
theme_checkboxincludes/form.incFormat a checkbox.
theme_checkboxesincludes/form.incFormat a set of checkboxes.
theme_dateincludes/form.incFormat a date selection element.
theme_fieldsetincludes/form.incFormat a group of form items.
theme_fileincludes/form.incFormat a file upload field.
theme_formincludes/form.incFormat a form.
theme_form_elementincludes/form.incReturn a themed form element.
theme_hiddenincludes/form.incFormat a hidden form field.
theme_image_buttonincludes/form.incTheme a form image button.
theme_passwordincludes/form.incFormat a password field.
theme_radioincludes/form.incFormat a radio button.
theme_radiosincludes/form.incFormat a set of radio buttons.
theme_selectincludes/form.incFormat a dropdown menu or scrolling selection box.
theme_submitincludes/form.incFormatuj przycisk wysyłający (submit button).
theme_tableselectincludes/form.incFormat a table with radio buttons or checkboxes.
theme_textareaincludes/form.incFormatuj pole tekstowe.
theme_textfieldincludes/form.incFormat a textfield.
theme_text_format_wrapperincludes/form.incReturn a themed text format form element.
theme_vertical_tabsincludes/form.incMakes the element's children fieldsets be vertical tabs.
weight_valueincludes/form.incIf no default value is set for weight select boxes, use 0.
_form_builder_handle_input_elementincludes/form.incPopulate the #value and #name properties of input elements so they can be processed and rendered.
_form_builder_ie_cleanupincludes/form.incIn IE, if only one submit button is present, AND the enter key is used to submit the form, no form value is sent for it and our normal button detection code will never detect a match. We call this function after all other button-detection is complete...
_form_button_was_clickedincludes/form.incHelper function to handle the sometimes-convoluted logic of button click detection.
_form_set_classincludes/form.incSets a form element's class attribute.
_form_set_valueincludes/form.incHelper function for form_set_value().
_form_validateincludes/form.incPerforms validation on form elements. First ensures required fields are completed, #maxlength is not exceeded, and selected options were in the list of options given to the user. Then calls user-defined validators.

Dodaj nową odpowiedź

  • Adresy internetowe są automatycznie zamieniane w odnośniki, które można kliknąć.
  • Dozwolone znaczniki HTML: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Znaki końca linii i akapitu dodawane są automatycznie.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

Więcej informacji na temat formatowania

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.