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 |
Jump to:
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
The "halve" & "double" buttons don't seem to work either.
#2
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
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
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
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
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
See http://drupal.org/node/268265#comment-1696630
#8
Thanks for your help, everyone, and apologies for taking so long, but I have now committed this fix to CVS.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.