TOPIC:

BF validation: check database for duplicate 4 days 9 hours ago #243787

  • Topic Author
  • lizcoutu@gmail.com
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 6
  • Thanks: 0
Hi,

I'd like my form to search for duplicates, when submited, in my db called jos6d_videogames from the field "Title".

Thanks for your help,

Elisabeth

Please Log in or Create an account to join the conversation.

BF validation: check database for duplicate 4 days 7 hours ago #243795

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
Hi,

I created an example form for you.
Please download, unzip and install the file attached in BF => Configuration => Package Installer.
Then head to Manage Forms and try out the form

The important parts are located here:

- the title field, must have the name "title" (the label doesn't matter)

- the custom validation in the title field's custom validation code (triggers an ajax call)

- the DB check in form => advanced => more options => form pieces => before form (checks the existence of the title for the ajax call)

Hope this helps!

File Attachment:

File Name: ajaxtitlecheck.zip
File Size:6 KB



Regards,
Markus
Attachments:

Please Log in or Create an account to join the conversation.

BF validation: check database for duplicate 2 days 8 hours ago #243970

  • Topic Author
  • lizcoutu@gmail.com
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 6
  • Thanks: 0
Hi,

First I want to thank you for your fast replies and assistance.

I tried to do the following in ''before form'':

if( JRequest::getVar('bf_title', null) !== null ){
while (@ob_get_level() > 0) {
@ob_end_clean();
}
$db = JFactory::getDBO();
$db->setQuery("Select s.id From #__facileforms_records As r, #__facileforms_subrecords As s Where s.record = r.id And r.form = ".$this->form." And s.`name` = 'title' And s.`value` = " . $db->Quote(JRequest::getVar('bf_title', null)));
if(trim($db->loadResult())){
echo 0;
} else {
echo 1;
}
exit;

And then in the validation form:

function ff_title_validation(element, message)
{
if(element.value.trim() == '') return 'Please enter a title';
var myreturn = '';
JQuery.ajaxSetup({async:false});
JQuery.post('index.php', { option: 'com_breezingforms', ff_form: ff_processor.form, Itemid: 0, format: 'html', title: element.value }, function(data){ if( data != '1' ){ message == '' ? myreturn = 'Title exists already!' : myreturn = message; } } );
return myreturn;
}

I'm not a coding expert, but please tell me which parts of these codes I must replace. For now, with these configurations, the form just freezes when I press submit.

Thank you again,

Elisabeth

Please Log in or Create an account to join the conversation.

BF validation: check database for duplicate 2 days 7 hours ago #243972

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
Hi,

do you mean it freezes without changing anything in the form I sent you or did you do some custom setup already?

If yes, then tell me please what you changed and/or export your form and attach it with your next reply (in that case, please select only your form, nothing else in the package creator).

Regards,
Markus

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.032 seconds

July Sale!

Discounts for all of our extensions + support. Ending July 31st!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!