/** * returns rendered form's html string * @param string $form_id form_id (and also form definitor function name) * @return string form html */ static function render_form($form_id) { $form = cs_form_builder::get_form($form_id); return $form->render(); }
// if sessions are enabled then the form uses a token for extra security against CSRF session_start(); require_once '../src/form.php'; include "forms.php"; // Submit function to call when the form is submitted and passes validation. // This is where you would send the email (using PHP mail function) // as this is not a real example I'm just outputting the values for now. function datesform_submit(&$form) { $form_values = $form->values(); return $form_values; //var_dump($form->get_triggering_element()); // Reset the form if you want it to display again. // $form->reset(); } $form = cs_form_builder::get_form('datesform'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example dates form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input,
// var_export($form); // get submission triggering element // var_dump($form->get_triggering_element()); return $form_values; // Reset the form if you want it to display again. // $form->reset(); } function showall_validate(&$form) { $form_values = $form->values(); if ($form_values['fieldset']['name'] == 'aaa' && $form_values['tabs']['slider'] == 2) { return "You shall not pass!!!"; } return TRUE; } $form = cs_form_builder::get_form('showallform'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example Show them all form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input,
require_once '../src/form.php'; include "forms.php"; require 'recaptchalib.php'; define('RECAPTCHA_PUBLIC_KEY', ''); define('RECAPTCHA_PRIVATE_KEY', ''); function multistepform_submit(&$form) { $form_values = $form->values(); // var_export($form); // get submission triggering element //var_dump($form->get_triggering_element()); return $form_values; // Reset the form if you want it to display again. // $form->reset(); } $form = cs_form_builder::get_form('multistepform'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example multistep form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input,
session_start(); require_once '../src/form.php'; include "forms.php"; // Submit function to call when the form is submitted and passes validation. // This is where you would send the email (using PHP mail function) // as this is not a real example I'm just outputting the values for now. function contactform_submit(&$form) { $form_values = $form->values(); $form->add_highlight('Message sent!'); print_r($form_values); //var_dump($form->get_triggering_element()); // Reset the form if you want it to display again. $form->reset(); } $form = cs_form_builder::get_form('contactform'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example contact form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input,
// if sessions are enabled then the form uses a token for extra security against CSRF session_start(); require_once '../src/form.php'; include "forms.php"; // Submit function to call when the form is submitted and passes validation. // This is where you would send the email (using PHP mail function) // as this is not a real example I'm just outputting the values for now. function locationsform_submit(&$form) { $form_values = $form->values(); return $form_values; //var_dump($form->get_triggering_element()); // Reset the form if you want it to display again. // $form->reset(); } $form = cs_form_builder::get_form('locationsform'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example locations form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input,
if (isset($_GET['clearsession'])) { session_destroy(); session_start(); } // Submit function to call when the form is submitted and passes validation. // This is where you would send the email (using PHP mail function) // as this is not a real example I'm just outputting the values for now. function eventsform_submit(&$form) { $form_values = $form->values(); //var_dump($form->get_triggering_element()); // Reset the form if you want it to display again. // $form->reset(); return $form_values; } $form = cs_form_builder::get_form('eventsform'); if (isset($_REQUEST['partial'])) { print $form->render(); } else { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example contact form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; }
// if sessions are enabled then the form uses a token for extra security against CSRF session_start(); require_once '../src/form.php'; include "forms.php"; // Submit function to call when the form is submitted and passes validation. // This is where you would send the email (using PHP mail function) // as this is not a real example I'm just outputting the values for now. function pluploadform_submit(&$form) { $form_values = $form->values(); if (is_array($form_values['files_upload']) && count($form_values['files_upload']) > 0) { print $value->temppath . " => " . getcwd() . DIRECTORY_SEPARATOR . $value->name . "\n"; rename($value->temppath, getcwd() . DIRECTORY_SEPARATOR . $value->name); } } $form = cs_form_builder::get_form('pluploadform'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>PLUpload Form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input,
if (!is_numeric($length) || $length == 0) { $length = 1; } return strlen("" . $string) > 0 && strlen("" . $string) % $length == 0 ? TRUE : '<strong>%t</strong> length must be multiple of ' . $length; } function nestableform_submit(&$form) { $form_values = $form->values(); // var_export($form); // get submission triggering element // var_dump($form->get_triggering_element()); return $form_values; // Reset the form if you want it to display again. // $form->reset(); } $form = cs_form_builder::get_form('nestableform'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example Nestable form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input,
<?php // if sessions are enabled then the form uses a token for extra security against CSRF session_start(); require_once '../src/form.php'; include "forms.php"; $form = cs_form_builder::get_form('batchoperationsform'); if (isset($_REQUEST['partial'])) { print $form->render(); } else { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Example contact form</title> <style> body { font-family: Arial; font-size: 14px; background: #c6c6c6; } label { display: block; } span.required { color: red; } .form-item.has-errors input, .form-item.has-errors select, .form-item.has-errors textarea { background-color: #FFA07A; } .form-item.has-errors label {