Linux 软件免费装

Forms

开发者 westonruter
更新时间 2010年4月2日 07:17
PHP版本: 2.7 及以上
WordPress版本: 2.9.1

标签

forms validation input web forms

下载

0.1.9

详情介绍:

This plugin is developed at Shepherd Interactive for the benefit of the community. No support is available. Please post any questions to the support forum. Allows forms to be written with new HTML5 input type and validation attributes, and then to have them validate themselves server-side: DRY forms (don't repeat yourself). Forms are embedded into posts via the form shortcode. Results can be automatically emailed. A web form is defined in a PHP function that returns an entire form element, for example: function my_contact_form($attrs, $content = null){ ob_start(); ?> <form method="post"> <p hidden="hidden" class="form_error_message"></p> <p>Name: <input type="text" required="required" name="contact_name" maxlength="255" placeholder="Jo Smith" autofocus="autofocus" /></p> <p>Email: <input type="email" required="required" name="contact_email" maxlength="255" placeholder="jsmith@example.com" /></p> <p>Message: <textarea required="required" name="contact_message" maxlength="1000" placeholder="Enter your message here"></textarea></p> <p><button type="submit">Submit</button></p> </form> <?php $ret = ob_get_contents(); ob_end_clean(); return $ret; } And this form can be embedded into a post by entering [form name="my_contact_form"]. Here are the shortcode options: These options may also be specified via Custom Fields (postmeta): Many filters and actions are available. Please see the source code. When the form is submitted and the server determines that user data is invalid, then the server will respond with 400 Invalid Request. In the 400 response, the page containing the form is returned and the form repopulated with the user's original request with class names and data- attributes that describe the errors on an invalid element. If the server successfully validates the form, then the user will be redirected to success_url or success_page_id if they are provided. Please see source code for full documentation. Handling File Inputs Files are uploaded to /wp-content/uploads/ (or whatever this is specified to be in your install), unless filtered to be something different via form_file_upload_path filter, or if the data-upload-path attribute is set on the file input element, for example: <input type="file" data-upload-path="<?php $uploadDir = wp_upload_dir(); echo esc_attr(parse_url(trailingslashit($uploadDir['baseurl']) . 'form-submissions/', PHP_URL_PATH)); ?>" name="my_image" pattern=".+\.(jpe?g|gif|png)" /> The upload path is appended to the ABSPATH, and it must be within the /wp-content/uploads/ directory (or equivalent) or a security exception will be raised. When the server fails to move the file or if it is too big or if some other error occurs (e.g. directory not writable), then the form submission will respond with a 500 error and the file control will be marked as invalid customError and the specific error will be included on the data-validationMessage attribute.

更新日志:

2010-04-01: 0.4 (beta11) 2010-01-22: 0.4 (beta10) 2009-11-04: 0.4 (beta6) 2009-10-29: 0.4 (beta5) 2009-10-15: 0.4 (beta2) 2009-10-06: 0.4 (beta) 2009-09-29: 0.3.9