TEMA:

Check duplicate value on Table by drop-down 1 año 4 meses antes #273571

  • Autor del tema
  • midimoinsdix
  • Fuera de línea
  • Navegador Senior
  • Navegador Senior
  • Registered
  • Mensajes: 100
  • Gracias recibidas: 0
Hi,
New challenge for a champion ;-)

I'm looking to check for duplicates of a variable record in a specific table (≠_subRecords).

My form consists of 2 drop-down menus (dynamically managed).

I managed to adapt the 4 scripts to my form inspired by CHECK IF EMAIL ALREADY ENTERED .

If there is a duplicate it is not saved and the script works B)
Except that I have a blank page that opens instead of the error message !? :(


I think I have a problem with this script: Advanced properties > More options > Form pieces and in the Before Form section
if( JRequest::getVar('listGraphicWorkshop', null) !== null ){
   while (@ob_get_level() > 0) {
    @ob_end_clean();
   }
   $db = JFactory::getDBO();
$idGame = ff_getSubmit('listGraphicWorkshop');
$idUser = ff_getSubmit('listuser');
$db->setQuery("SELECT * FROM `#__specifTable` WHERE `id_GameUser` = " .$db->quote($idUser)." AND `id_Game` = " . $db->quote($idGame));
   if(trim($db->loadResult())){
     echo 0;
   } else {
     echo 1;
   }
   exit;
}


This one seems to me to work since it does not save any duplicates.
Advanced properties > More options > Submit pieces and in the Begin Submit section
$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();

$idGame = ff_getSubmit('listGraphicWorkshop');
$idUser = ff_getSubmit('listuser');
$db->setQuery("SELECT * FROM `#__specifTable` WHERE `id_GameUser` = " .$db->quote($idUser)." AND `id_Game` = " . $db->quote($idGame));
if(trim($db->loadResult())){
 exit;
}

What do you think ?
Thanks for your help

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

Última Edición: Post by midimoinsdix.

Check duplicate value on Table by drop-down 1 año 4 meses antes #273574

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderador
  • Moderador
  • Registered
  • Mensajes: 12079
  • Gracias recibidas: 788
Hi,

please use your second script, because in ff_getSubmit you can use in submit pieces, not in form pieces.
That is the reason why you get error using this in form pieces

Second script seems ok

Let me know the result

Regards,
Tihana

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

Última Edición: Post by tihana.krivic.

Check duplicate value on Table by drop-down 1 año 4 meses antes #273577

  • Autor del tema
  • midimoinsdix
  • Fuera de línea
  • Navegador Senior
  • Navegador Senior
  • Registered
  • Mensajes: 100
  • Gracias recibidas: 0
I used the both like you do on CHECK IF EMAIL ALREADY ENTERED !

On your advice I deleted the Form pieces ,
but nothing changes !?

A other idea ?

Regards

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

Check duplicate value on Table by drop-down 1 año 4 meses antes #273578

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderador
  • Moderador
  • Registered
  • Mensajes: 12079
  • Gracias recibidas: 788
Hi,

using this (check if email is already entered), you check for field which you want.

If you want I can check it directly in your form, and apply the code there, but I need backend link, login information, form name, and field in which you want to add this.

Use this tag:
[confidential]
[/confidential]

I will check everything, and find where is a problem

Regards,
Tihana

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

Check duplicate value on Table by drop-down 1 año 4 meses antes #273580

  • Autor del tema
  • midimoinsdix
  • Fuera de línea
  • Navegador Senior
  • Navegador Senior
  • Registered
  • Mensajes: 100
  • Gracias recibidas: 0
Thank' to have a look

Este mensaje contiene información confidencial

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

Check duplicate value on Table by drop-down 1 año 4 meses antes #273581

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderador
  • Moderador
  • Registered
  • Mensajes: 12079
  • Gracias recibidas: 788
Hi,

you can't use this script on that way. Basically, this script is connect to one field, in your case listAtelierGraphique, am I right?
Then you need to use everything, validation, actionscript, before form pieces, begin submit (same as in documentation), and in form pieces, you can't use ff_getSubmit because this is for submit pieces.
For this you need select directly value from database, on the same way as it is described in documentation.

If you can give me access to this "#__specifictable", it would be great

I will see how to check this and let you know, please give me some time

Regards,
Tihana

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

Última Edición: Post by tihana.krivic.
Tiempo de carga de la página: 0.064 segundos

Live Support Chat Opened!

Join our Discord chat here and enter the Crosstec channels to receive live support and talk directly to the team!