Yield does not show populated when viewing the recipe

swirt - May 27, 2008 - 20:13
Project:Recipe
Version:6.x-1.0-beta1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

When viewing a recipe the yield box is not populated with the submitted yield (yes teh value of the yield was submitted and did get saved). Entering a yield in the viewed form does cause teh recipe to calculate and show the proper values, but it never shows what the default yield was to begin with. example recipe

#1

DomeMinion - June 6, 2008 - 15:54

The "halve" & "double" buttons don't seem to work either.

#2

swirt - June 7, 2008 - 01:40

The buttons work, but they depend on a value to be in that box. If you place a value in the box and press half or double, it will process it based on that value. It just needs the value to be populated from the node, but it isn't happening.

#3

swirt - June 9, 2008 - 19:03

I found the problem.

near line 1475 this function is defined "function recipe_custom_yield_form($node) {"

and near line 1397 the function is called using drupal_get_form
"$yield = drupal_get_form('recipe_custom_yield_form', $node);"

For some reason inside the function, $node loses its value.

I am not sure why $node loses its value within the function. I hacked my way around the problem by making a global variable before the function is called and then accesing it within the function. (not ideal I know.)

#4

icymetal - June 22, 2008 - 20:24

When I enter a value into the YIELD field and submit, it does not show in that field. I tried to enter a number and use the double or half buttons but this doesn't work either. Also, when I go back to edit it, it's empty. Same with the INSTRUCTION and NOTES fields.

#5

IanBezanson - June 9, 2009 - 23:00

Line 1473 is:

function recipe_custom_yield_form($node) {

should be:

function recipe_custom_yield_form($form_id, $node) {

in Drupal 6, any form function declaration expects (well, requires) $form_id as the first element. As it stands, when you reference $node within that function, you're really referencing the $form_id element being passed in first. This change opens up the form to work as expected.

#6

lionheart8 - June 12, 2009 - 17:35

Hi
thanks for this.
It solves the Yield problem. I have not seen "yield" in months for all recipes!!!!

There's still a problem, though when editing, once one goes to "Preview" the ingredients disappear & have to be filled in anew :((
I suppose there's also the issue when submitting a new recipe, having to fill in the ingredients during previewing & NOT before for the same reason.

Any solution to this?

#7

jbemmel - June 13, 2009 - 20:56

#8

marble - June 26, 2009 - 11:54
Status:active» fixed

Thanks for your help, everyone, and apologies for taking so long, but I have now committed this fix to CVS.

#9

System Message - July 10, 2009 - 12:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.