You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OneBadNinja edited this page Nov 29, 2017
·
3 revisions
Once fields and validation rules have been assigned, you may generate the HTML for the form using the generate() method. generate() must be followed by get_scripts() which outputs the necessary javascript needed to run the form.
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>Contact Us</title><!-- default stylesheet --><linkrel="stylesheet" type="text/css" href="includes/handymail/assets/css/handymail.css"/><scriptsrc="https://code.jquery.com/jquery-1.12.4.min.js"></script></head><body><h1><?php echo $form->name; ?></h1><!-- Generate form HTML --><?php echo $form->generate(); ?><!-- Generate form scripts --><?php echo $form->get_scripts(); ?></body></html>
Further customising generated code.
Supplying a boolean true argument to either generate() or get_scripts() will print the raw HTML and javascript code instead. You can take this and customise as desired.
Protip: do not delete or add any fields - run_validation() will prevent form submissions if fields are not explicitly defined with add_field(). This is an intended security measure.