On Mon, Jul 6, 2009 at 1:34 AM, Jeppe Nejsum Madsen <je...@ingolfs.dk>wrote:

>
> On Fri, Jul 3, 2009 at 6:43 PM, David
> Pollak<feeder.of.the.be...@gmail.com> wrote:
> > Jeppe,
> >
> > Once I check in some code (in about 20 minutes), if you run Lift in Test
> > mode (-Drun.mode=test), forms, etc. will have stable names which makes
> > testing easier.
>
> Thanks. I just tried this, and it seem something is not correct.
> Here's a form field genrated by CRUDify:
>
> <input  name="f00000000010000000_a0f86e3b78187b55b8628a66fb3371113ddc295c"
> type="text" maxlength="2" value="DK" lift:field_name="vehicle:country"
> />
>
> Firefox 3.5 complains about lift:field attribute.


THat's very odd.  The lift namespace should be defined for the page.


>
>
> Looking at the changes (and the example above) it seems that the field
> name is still some psuedo random number.


It's not a random number, it's an algorithmically produced number based on
the stack frames below the request for the identifier.


> While this is better than
> names changing between each request, I'm wondering if it's stable to
> reordering & removing fields (my guess is no).


It's stable for reordering the fields on the page.  It's not stable for
re-ordering the calls on the server side.  Just as with all Lift's bind
stuff, the order of the field creation is the order of evaluation.  The GUID
must reflect that ordering.


> It would be nice not to
> change test cases just because we rearrange the form layout.


You can rearrange the view code without impacting the field names.

>
>
> Moving forward, I'm not sure what the best solution is. I seem able to
> specify the id attribute for forms that I create manually, but need
> this also on CRUDify and other generated forms (and looking at the
> above example, it seems it should be easy to eg. use the field_name).
> In general, It would be nice for Lift to handle all this automatically
> (as you've already started out to do), but if I have to add some
> additional markup to make sure ids/names stay stable, I will prefer
> that over test cases breaking if field ordering is changed.....


If you've got suggestions that don't break Lift, I'm all ears.

Thanks,

David


>
>
> /Jeppe
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to