Subject: | New Beer::Brewery::Create New Brewery select option doesn't work |
it's trying to redirect to /brewery/edit which won't work to create a new brewerey.
the redirect doesn't work in any case because the "class" field is not actually available to test against (that is the following conditional is never true even though class='redirect' is in the html (tried on Firefox and IE)
if (box.options[box.selectedIndex].class == 'redirect')
see
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/option.html
this works as a replacement:
(in templates/custom/header,templates/factory/header)
function go(box)
{
destination = box.options[box.selectedIndex].value;
if (destination.indexOf("[%base%]") == 0)
location.href = destination;
}
(in ./templates/beer/addnew)
element.attr("onChange", "go()");
=>
element.attr("onChange", "go(this)");
but it should redirect to /brewery/addnew instead of /brewery/edit
(in ./templates/beer/add)
SET create_url = base _ "/brewery/edit";
=>
SET create_url = base _ "/brewery/add";
follow this for add:
http://wiki.simon-cozens.org/index.cgi?AddPages
Even if the javascript worked as designed though, it doesn't seem like a great solution unless the values the user already entered in the Add Beer fields were saved until after the Brewery was created so they could pick up where they left off.