How to limit form's submission - one form per one email

Please ask questions, report bugs and share your ideas about SmartFormer Gold for Joomla in this forum

How to limit form's submission - one form per one email

Postby IToris team » Thu Apr 16, 2009 11:24 pm

E.g. our HTML field for email has "email" name attribute.

Please add the following code to PHP editor:
Code: Select all
$email = @$form->data['email']; //getting email from POST 
if ($email !="") { 
      $database=& JFactory::getDBO(); // getting DB object 
      $dbname = $form->formXMLStruct['database']['name']; // getting the name of associated DB table 
      // settin DB request 
      $database->setQuery('select `id` from '.$dbname.' where `email`='.$database->Quote($email)); 
      $rid = intval($database->loadResult()); // get record ID if it exists 
      if ($rid > 0 && $rid != $form->db_id) { 
           $form->page = 0; // return to 1st form page 
           $form->error = "The email already exists"; 
      } 


The code should be entered before $form->renderForm();
IToris team
Site Admin
 
Posts: 1355
Joined: Mon Jan 19, 2009 12:33 pm

Re: How to limit form's submission - one form per one email

Postby Mahsa Hatefi » Thu Feb 23, 2012 12:09 am

Hi there
Does this code work in SF ? if so , i put it in a form with "email" name element but it didn't work .
Would you please help with this point ?
Mahsa Hatefi
 
Posts: 1
Joined: Wed Feb 22, 2012 11:54 pm

Re: How to limit form's submission - one form per one email

Postby IToris team » Thu Mar 22, 2012 2:16 pm

Hello Mahsa Hatefi,

This solution works for SFG only. Please modify this solution for SF or post a new ticket on our online Help Desk. SmartFormer is absolutely free now and we do not provide free support for this extension.

IToris Team
IToris team
Site Admin
 
Posts: 1355
Joined: Mon Jan 19, 2009 12:33 pm


Return to SmartFormer Gold for Joomla

Who is online

Users browsing this forum: Google [Bot] and 0 guests