I wrote
>>>> BUT on the list page it also appears to cause search parameters to
>>>> be transferred to the addnew box after pressing 'search'. This seems
>>>> wrong.
Simon Flack wrote:
>>> I noticed that, and I thought I'd fixed it by cloning the
>>> HTML::Element returned by classmetadata.cgi.$col:
>>> SET elem = classmetadata.cgi.$col.clone;
>>> Do you have that line in your 'addnew' template?
I wrote:
>> That'll be what that line was for, then :) Sorry. I'll try it tomorrow.
>
> I tried it but I still see the same symptom. Looking at the URL after my
> search, I don't understand how cloning the element would stop the
> request parameters matching?:
>
> http://localhost/cgi-bin/qd1.cgi/coords/search/?id=&name=gi&bio_database_id=&search=search
I'm still seeing this in 2.08. I've just tried again with a conventional
BeerDB.pm and the 2.08 factory templates. If I go to brewery/list, type
the name of a brewery into the name field of the search form, then after
I press search, I see the brewery name in the addnew form.
So I think this is a problem in the distribution. Can somebody confirm
whether or not you see the same symptoms please? TIA.
BTW, in poking around trying to understand this, I came across what
looks like a bug in the factory search_form template. It seems to be
using the class's moniker to construct URLs instead of its table. I know
there was a discussion where it was generally agreed this would be a
good idea but I don't think that change has been made yet. Specifically,
the search_form template disagrees with both addnew and pager (and
others) about what's right:
/2.08-release/factory$ grep -E 'classmetadata.(moniker|table)' *
addnew:<DEFANGED_form method="post" action="[% base %]/[% classmetadata.table
%]/do_edit/">
addnew:<legend>Add a new [% classmetadata.moniker %]</legend>
edit:<div id="title">Edit a [% classmetadata.moniker %]</div>
list: link(classmetadata.table, action, additional,
navbar: '<li '; 'id="active"' IF table == classmetadata.table; '>';
pager: link(classmetadata.table, action, args, label);
search_form:<DEFANGED_form method="get" action="[% base %]/[%
classmetadata.moniker %]/search/">
Cheers, Dave
> My custom/addnew.tt is different to the factory/addnew of course. Here
> it is in case there's some other significant difference:
>
> [%- table = classmetadata.table -%]
> <div id="addnew">
> <DEFANGED_form method="post" action="[% base %]/[% table %]/do_edit/">
> <fieldset>
> <legend>Add a new [% tables.$table.singular %]</legend>
> [% USE model = Class(classmetadata.name) ;
> FOR col = classmetadata.columns ;
> NEXT IF columns.$table.$col.primary %]
> <label>
> <span class="field">[% columns.$table.$col.singular %]</span>
> [% elem = model.to_field(col).clone ;
> param = request.param(col) ;
> IF param ;
> IF elem.tag == 'textarea' ;
> elem = elem.push_content(param) ;
> ELSE ;
> elem.attr("value", param) ;
> END ;
> END ;
> elem.as_XML ;
> -%]
> </label>
> [% IF errors.$col %]
> <span class="error">[% errors.$col %]</span>
> [% END ;
> END %]
> [% IF errors.FATAL %]
> <span class="error">[% errors.FATAL %]</span>
> [% END ; %]
> <input type="submit" name="create" value="create"/>
> </fieldset>
> </form>
> </div>
_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole
This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT