TOPIC:

Check duplicate value on Table by drop-down 2 weeks 16 hours ago #273571

  • Topic Author
  • midimoinsdix
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 73
  • Thanks: 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

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

Last edit: Post by midimoinsdix.

Check duplicate value on Table by drop-down 2 weeks 6 hours ago #273574

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10068
  • Karma: 3
  • Thanks: 679
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

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

Last edit: Post by tihana.krivic.

Check duplicate value on Table by drop-down 2 weeks 6 hours ago #273577

  • Topic Author
  • midimoinsdix
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 73
  • Thanks: 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

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

Check duplicate value on Table by drop-down 2 weeks 5 hours ago #273578

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10068
  • Karma: 3
  • Thanks: 679
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

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

Check duplicate value on Table by drop-down 2 weeks 5 hours ago #273580

  • Topic Author
  • midimoinsdix
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 73
  • Thanks: 0
Thank' to have a look

This message contains confidential information

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

Check duplicate value on Table by drop-down 2 weeks 5 hours ago #273581

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10068
  • Karma: 3
  • Thanks: 679
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

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

Last edit: Post by tihana.krivic.
Time to create page: 0.053 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

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!