function addMember($member, $option, $mailing_list_groups) { //JHTML::_('behavior.calendar'); JHTML::_('behavior.formvalidation'); // Added 2012.07.22 Bart McPherson Givecamp // to add/modify required fields follow example at http://docs.joomla.org/Client-side_form_validation ?> <script type="text/javascript"> /* Override joomla.javascript, as form-validation not work with ToolBar */ function submitbutton(pressbutton) { if (pressbutton == 'showall') { submitform(pressbutton); }else{ var f = document.adminForm; if (document.formvalidator.isValid(f)) { submitform(pressbutton); } else { var msg = new Array(); msg.push('Invalid input, please verify again!'); if ($('nameFirst').hasClass('invalid')) { msg.push('<?php echo JText::_('First Name is required'); ?> '); } if ($('nameLast').hasClass('invalid')) { msg.push('<?php echo JText::_('Last Name is required'); ?> '); } if($('emailAddress').hasClass('invalid')){ msg.push('<?php echo JText::_('A valid email address is required'); ?> '); } alert (msg.join('\n')); } } } </script> <form action="index.php" method="post" class="form-validate" name="adminForm" id="adminForm"> <fieldset class="adminform"> <legend>Member Details</legend> <table class="admintable"> <tr> <tr> <td width="100" align="right" class="key"> First Name: </td> <td> <input class="required text_area" type="text" name="nameFirst" id="nameFirst" size="20" maxlength="50" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Last Name: </td> <td> <input class="required text_area" type="text" name="nameLast" id="nameLast" size="20" maxlength="50" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Address 1: </td> <td> <input class="text_area" type="text" name="address1" id="address2" size="20" maxlength="50" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Address 2: </td> <td> <input class="text_area" type="text" name="address2" id="address2" size="20" maxlength="50" /> </td> </tr> <tr> <td width="100" align="right" class="key"> City: </td> <td> <input class="text_area" type="text" name="city" id="city" size="20" maxlength="50" /> </td> </tr> <tr> <td width="100" align="right" class="key"> State: </td> <td> <input class="text_area" type="text" name="state" id="state" size="20" maxlength="50" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Zip: </td> <td> <input class="text_area" type="text" name="zip" id="zip" size="20" maxlength="50" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Email Address: </td> <td> <input class="required validate-email text_area" type="text" name="emailAddress" id="emailAddress" size="50" maxlength="250" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Primary Phone: </td> <td> <input class="text_area" type="text" name="phoneMain" id="phoneMain" size="50" maxlength="250" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Alternate Phone: </td> <td> <input class="text_area" type="text" name="phoneAlt" id="phoneAlt" size="50" maxlength="250" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Emergency Phone: </td> <td> <input class="text_area" type="text" name="phoneEmerg" id="phoneEmerg" size="50" maxlength="250" /> </td> </tr> <tr> <td width="100" align="right" class="key"> Groups: </td> <td> </td> </tr> <?php // list all group associations foreach (CbodbMember::$memberGroupArray as $groupNum => $groupName) { ?> <tr> <td width="100" align="right" class="key"> <?php echo $groupName; ?> </td> <td> <input type="checkbox" name="isGroup<?php echo $groupNum; ?> " id="isGroup<?php echo $groupNum; ?> " /> </td> </tr> <?php } ?> <tr> <td width="100" align="right" class="key"> <?php echo "Class 1: Intro"; ?> </td> <td> <input type="checkbox" name="custom1" id="custom1" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <?php echo "Class 2: Wheels"; ?> </td> <td> <input type="checkbox" name="custom2" id="custom2" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <?php echo "Class 3: Brakes"; ?> </td> <td> <input type="checkbox" name="custom3" id="custom3" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <?php echo "Class 4: Gears"; ?> </td> <td> <input type="checkbox" name="custom4" id="custom4" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <?php echo "Bike Driver's Ed"; ?> </td> <td> <input type="checkbox" name="custom5" id="custom5" /> </td> </tr> </table> </fieldset> <?php HTML_cbodb::listMailingListSubscriptionOptions($mailing_list_groups); ?> <input type="hidden" name="id" value="<?php echo $member->id; ?> " /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="cbodb_mode" value="member" /> <input type="hidden" name="new_member" value="1" /> </form> <?php }
function newMember($option, $mailing_list_groups, $postRow = NULL) { ?> <h2>Sign up to volunteer</h2> <?php if (isset($postRow['option'])) { echo 'Sorry, but you must enter both a first name and emergency phone number to sign up!'; } ?> <form action="index.php#top" method="post" name="newmemberform"> <table> <tr> <td width="150" align="right" class="key"> First Name: </td> <td> <input class="text_area" type="text" name="nameFirst" id="nameFirst" size="20" maxlength="50" value="<?php if (isset($postRow->nameFirst)) { echo $postRow->nameFirst; } ?> " /> </td> </tr> <tr> <td width="150" align="right" class="key"> Last Name: </td> <td> <input class="text_area" type="text" name="nameLast" id="nameLast" size="20" maxlength="50" value="<?php if (isset($postRow->nameLast)) { echo $postRow->nameLast; } ?> " /> </td> </tr> <tr> <td width="150" align="right" class="key"> Email Address: </td> <td> <input class="text_area" type="text" name="emailAddress" id="emailAddress" size="50" maxlength="250" value="<?php if (isset($postRow->emailAddress)) { echo $postRow->emailAddress; } ?> " /> </td> </tr> <tr> <td width="150" align="right" class="key"> Primary Phone: </td> <td> <input class="text_area" type="text" name="phoneMain" id="phoneMain" size="50" maxlength="250" value="<?php if (isset($postRow->phoneMain)) { echo $postRow->phoneMain; } ?> " /> </td> </tr> <tr> <td width="150" align="right" class="key"> Alternate Phone: </td> <td> <input class="text_area" type="text" name="phoneAlt" id="phoneAlt" size="50" maxlength="250" value="<?php if (isset($postRow->phoneAlt)) { echo $postRow->phoneAlt; } ?> " /> </td> </tr> <tr> <td width="150" align="right" class="key"> Emergency Phone <font color="Red">(required)</font>: </td> <td> <input class="text_area" type="text" name="phoneEmerg" id="phoneEmerg" size="50" maxlength="250" value="<?php if (isset($postRow->phoneEmerg)) { echo $postRow->phoneEmerg; } ?> " /> </td> </tr> <!-- <tr> <td colspan="2" align="left" class="key"> Would you like to get email from us? (You can change this later) <input type="checkbox" name="emailNews" id="emailNews" <?php if (isset($postRow->emailNews) && $postRow->emailNews) { echo 'checked="checked"'; } ?> /> </td> </tr> --> </table> <?php HTML_cbodb::listMailingListSubscriptionOptions($mailing_list_groups); ?> <br> <input type="submit" name="membersubmit" value="Save and Finish"> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="savenewmember" /> </form> <?php $option = "com_cbodb"; $link = JRoute::_('index.php?option=' . $option . '&task=shop&key=3b767559374f5132236f6e68256b2529' . '#top'); echo '<br /><h2>or <a href=' . $link . '>Return to Clock-In Page</a></h2>'; ?> <?php }