For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2006 > Html_Quickform multiple forms









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Html_Quickform multiple forms
Atif Khan

2006-06-24, 8:09 am

I am using two forms, but the the add rule will not say that
the field is required.


<?php

// Load the QuickForm code
require "HTML/QuickForm.php";

$form1 = new HTML_QuickForm("form1", 'GET', null, null, null, true);
$form1->addElement("text","entered_text","Enter text 1");
$form1->addElement("submit","submit","Submit1");

$form1->addRule("entered_text","You must enter text","required");

$form1->display();

if ($form1->validate()){
print "this is Form 1";

}


$form2 = new HTML_QuickForm("form2", 'GET', null, null, null, true);
$form2->addElement("text","entered_text","Enter text 1");
$form2->addElement("submit","submit","Submit2");

$form2->addRule("entered_text","You must enter text","required");

$form2->display();


if ($form2->validate()){
print "form_2";
}

?>

thank you
ATif K
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com