Bienvenido, Invitado
Recordarme

TEMA:

BF validation: check database for duplicate 1 año 3 meses antes #243787

  • Autor del tema
  • lizcoutu@gmail.com
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 7
  • Gracias recibidas: 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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BF validation: check database for duplicate 1 año 3 meses antes #243795

  • Avatar de TheMuffinMan
  • TheMuffinMan
  • Fuera de línea
  • Developer
  • Developer
  • Mensajes: 10064
  • Karma: 167
  • Gracias recibidas: 808
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!

Archivo Adjunto:

Nombre del Archivo: ajaxtitlecheck.zip
Tamaño del Archivo:6 KB



Regards,
Markus
Adjuntos:

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BF validation: check database for duplicate 1 año 3 meses antes #243970

  • Autor del tema
  • lizcoutu@gmail.com
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 7
  • Gracias recibidas: 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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BF validation: check database for duplicate 1 año 3 meses antes #243972

  • Avatar de TheMuffinMan
  • TheMuffinMan
  • Fuera de línea
  • Developer
  • Developer
  • Mensajes: 10064
  • Karma: 167
  • Gracias recibidas: 808
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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BF validation: check database for duplicate 1 año 3 meses antes #244131

  • Autor del tema
  • lizcoutu@gmail.com
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 7
  • Gracias recibidas: 0
Hi Markus,

What I've done, and that I'm sure is not working, is to replace 'bf_title' in both before sending form and the validation part by 'title' so it can refer to the name in my table.

I also replaced in before sending form #__facileforms_records by the name of my table, but I'd agree to tell that I don't understand this "Select s.id From #__facileforms_records As r, #__facileforms_subrecords As s Where s.record = r.id And r.form = " as there are two tables referring to it and as i use only one.

Thanks very much for your help,

Elisabeth
Adjuntos:

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BF validation: check database for duplicate 1 año 3 meses antes #244141

  • Avatar de TheMuffinMan
  • TheMuffinMan
  • Fuera de línea
  • Developer
  • Developer
  • Mensajes: 10064
  • Karma: 167
  • Gracias recibidas: 808
ok, let me look into it.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
  • 2
Tiempo de carga de la página: 0.058 segundos