1
preachur
Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/26 5:47

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


On XOOPS 2.2 or 2.3 the recette (recipes) module works fine. on 2.0.18.1 all the ingredients are required. In other words, if you only enter 3 ingredients it wants you to fill up all the other fields before it will allow you to submit. Since there are 30 fields you can see why it doesn't work. I am thinking it is somewhere in this piece of code, but every time I try to fix it I mess up the whole thing.
for ( $ii=0;$ii<$nbingredient;$ii++ )
    {
        
$jj=$ii+1;
        ${
'ligne'.$ii} = new XoopsFormElementTray(_NW_INGREDIENT);
        if ( 
$ii+1>count($quantite) )
        {
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040''), true);
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_INGREDIENT'ing'.$jj2050''), true);        
        }
        else
        {
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040$quantite[$ii]), true);
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_INGREDIENT'ing'.$jj2050$ingredient[$ii]), true);
        }
        
$add_btn = new XoopsFormButton('''addIng'_NW_AJOUT_ING'submit');
        
$add_btn->setExtra('accesskey="a"');
        ${
'ligne'.$ii}->addElement($add_btn);
        
$sform->addElement(${'ligne'.$ii});
    }


Any help would be appreciated. Blessings!
Magick can never be restrained, but when freely given is thrice regained!

2
Peekay
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/26 10:31

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I had a problem with the Recette module as described in this post. I was using XOOPS 2.0.13.2 at the time. I don't know if the disappearing field issue exists in 2.2. What version of Recette are you using?.
A thread is for life. Not just for Christmas.

3
preachur
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/26 12:08

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


Version 2.2 of Recette... IF I can get it to work.

I am currently testing other modules to possibly modify something to work better. I HAD a recipe module I made myself in 2004 running, but it doesn't work quite right in 2.0.18. White screens on submit even though it does submit... and the ingredients and directions display on separate pages which annoys users. Plus, I don't think it is secure at all. So I am trying to get something better working.
Magick can never be restrained, but when freely given is thrice regained!

4
preachur
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/26 23:13

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


Well, once again one of DJ's modules is bailing me out. I am using his Article module with a category for recipes. The module seriously has everything. It will easily handle all of my information sharing needs. Since it is a collaborative information portal, it will work perfectly.
Magick can never be restrained, but when freely given is thrice regained!

5
zyspec
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/26 23:42

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Just for future reference, or in case someone else reads this and needs the answer...

The addElement function allows you to set whether a field is required or not... to change this in the above code just remove ', true' from the addElement() calls above. For example:

${'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040''), true);


would become:
${'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040''));

6
preachur
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/26 23:51

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


Wow, thanks. I tried that, but I took the hash marks out as well and got a white screen. I will try that on my other site that has recipe listings.
Magick can never be restrained, but when freely given is thrice regained!

7
Yurdal
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/28 22:00

  • Yurdal

  • Friend of XOOPS

  • Posts: 386

  • Since: 2005/3/27


Hmm i want to try the solution but which file must be edited ?

8
Lloyd
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/28 23:34

  • Lloyd

  • Just popping in

  • Posts: 43

  • Since: 2006/7/4 1


Hmm i want to try the solution but which file must be edited ?


look in recette/include/storyform.inc.php around line 89

9
Yurdal
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/5/29 8:20

  • Yurdal

  • Friend of XOOPS

  • Posts: 386

  • Since: 2005/3/27


Hmm i made a small change and it works now

Find:
// Ajout des ingrédients
$nbingredientF = new XoopsFormHidden('nbingredient'$nbingredient);
$sform->addElement($nbingredientF);
    
    for ( 
$ii=0;$ii<$nbingredient;$ii++ )
    {
        
$jj=$ii+1;
        ${
'ligne'.$ii} = new XoopsFormElementTray(_NW_INGREDIENT);
        if ( 
$ii+1>count($quantite) )
        {
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040''), true);
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_INGREDIENT'ing'.$jj2050''), true);        
        }
        else
        {
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040$quantite[$ii]), true);
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_INGREDIENT'ing'.$jj2050$ingredient[$ii]), true);
        }
        
$add_btn = new XoopsFormButton('''addIng'_NW_AJOUT_ING'submit');
        
$add_btn->setExtra('accesskey="a"');
        ${
'ligne'.$ii}->addElement($add_btn);
        
$sform->addElement(${'ligne'.$ii});
    }



Replace:

// Ajout des ingrédients
$nbingredientF = new XoopsFormHidden('nbingredient'$nbingredient);
$sform->addElement($nbingredientF);
    
    for ( 
$ii=0;$ii<$nbingredient;$ii++ )
    {
        
$jj=$ii+1;
        ${
'ligne'.$ii} = new XoopsFormElementTray(_NW_INGREDIENT);
        if ( 
$ii+1>count($quantite) )
        {
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040''), false);
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_INGREDIENT'ing'.$jj2050''), false);        
        }
        else
        {
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_QT'qt'.$jj1040$quantite[$ii]), false);
            ${
'ligne'.$ii}->addElement(new XoopsFormText(_NW_INGREDIENT'ing'.$jj2050$ingredient[$ii]), false);
        }
        
$add_btn = new XoopsFormButton('''addIng'_NW_AJOUT_ING'submit');
        
$add_btn->setExtra('accesskey="a"');
        ${
'ligne'.$ii}->addElement($add_btn);
        
$sform->addElement(${'ligne'.$ii});
    }

10
preachur
Re: Recette on 2.0.18.1 - Ingredients and amounts required
  • 2008/7/23 19:31

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


I found an updated version of this module somewhere but I lost the link.... Updated in July and it works perfectly on 2.0.18. PM me if you need me to re-zip it and upload it. I also fixed a few poor english translations and added a title and submit button at the top.
Magick can never be restrained, but when freely given is thrice regained!

Login

Who's Online

166 user(s) are online (94 user(s) are browsing Support Forums)


Members: 0


Guests: 166


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits