Re: [fw-general] Form elements, filters, validators and localized representation of values

2013-05-23 Thread Andreas Möller
Hello Matthew,


Thanks for your reply!

> That's a view layer issue. In my view script, I'd extract any elements
> that I know need localization, and prepare them accordingly before
> rendering them. This might involve extracting the value, localizing
> it, and then passing it back into the element, or it might involve
> manually rendering the HTML for that particular element. Either way,
> however, that's a job to do in the view.

I'm aware that this is an issue of the view layer.

I wondered whether there was already a solution for this implemented, for 
example in any form element view helpers. 


Best regards,

Andreas


--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Form elements, filters, validators and localized representation of values

2013-05-23 Thread Matthew Weier O'Phinney
On Thu, May 23, 2013 at 2:26 AM, Andreas Möller  wrote:
> I was just wondering how you would go about and solve the following problem:
>
> * You've got a form with elements that should allow a user to edit data which 
> may have different representations depending on the currently chosen locale 
> (for example: floats, dates)
> * Employing filters, the values are normalised and persisted.
> * When editing previously saved data, you want to render the values 
> (populate) the form with the representation fitting to the currently chosen 
> locale.
>
> So, similar to filtering the values before persisting them, they should be 
> filtered so the user is presented the values as she entered them into the 
> form.
>
> For example, if you have a form element used for editing a float, you 
> probably have filters applied so when for example you enter the string 3,1415 
> in de_DE, it will be filtered to 3.1415 which you can persist as an actual 
> float (DECIMAL) in the database. However, when you populate your form with 
> the data extracted from your model, the value will be the float 3.1415 and 
> both the representation of the value is not what you would expect and the 
> form element will not validate.
>
> How would you solve this problem?

That's a view layer issue. In my view script, I'd extract any elements
that I know need localization, and prepare them accordingly before
rendering them. This might involve extracting the value, localizing
it, and then passing it back into the element, or it might involve
manually rendering the HTML for that particular element. Either way,
however, that's a job to do in the view.



--
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Re: ZF2.2 form element name wrapping behaviour change

2013-05-23 Thread Marco Pivetta
If this is an issue, you should report it on the issue tracker instead.
Since you also found the commit that causes it, a test is also useful to
show the BC break.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 22 May 2013 08:07, Matus Zeman  wrote:

> Any comments on this as it's very important feature to be discussed I
> believe?
>
> Matus
>
>
> On 20 May 2013 21:04, Matus Zeman  wrote:
>
> > Hi there,
> > It looks like form element name "wrapping" does not work as in previous
> > versions of ZF2.
> > It's related to this commit:
> >
> https://github.com/zendframework/zf2/commit/768c3d8347bd76ae86f1a6832e374cbe12c2cef1
> >
> > To explain:
> > Pre version 2.2:
> > When you added "child" Form into a Form all element names (of child form)
> > were prefixed by parent form name automatically and parent form elements
> > were not prefixed at all - I considered this as logical and correct
> > behaviour (maybe not?).
> >
> > In version 2.2:
> > Either child form element names are not prefixed
> > OR
> > When I set setWrapElements(true) on the parent form all elements are
> > prefixed including child ones so I would have e.g. registration[id],
> > registration[auth_credential][identity],
> > registration[auth_credential][password]...
> >
> > Is this intended behaviour? It hasn't been like in any of earlier
> versions
> > of ZF2.
> > If it is, what's the best way how to achieve pre 2.2 behaviour?
> >
> > Cheers,
> > Matus
> >
>


[fw-general] Form elements, filters, validators and localized representation of values

2013-05-23 Thread Andreas Möller
Hello!


I was just wondering how you would go about and solve the following problem:

* You've got a form with elements that should allow a user to edit data which 
may have different representations depending on the currently chosen locale 
(for example: floats, dates)
* Employing filters, the values are normalised and persisted.
* When editing previously saved data, you want to render the values (populate) 
the form with the representation fitting to the currently chosen locale.

So, similar to filtering the values before persisting them, they should be 
filtered so the user is presented the values as she entered them into the form.

For example, if you have a form element used for editing a float, you probably 
have filters applied so when for example you enter the string 3,1415 in de_DE, 
it will be filtered to 3.1415 which you can persist as an actual float 
(DECIMAL) in the database. However, when you populate your form with the data 
extracted from your model, the value will be the float 3.1415 and both the 
representation of the value is not what you would expect and the form element 
will not validate.

How would you solve this problem?


Best regards,

Andreas


--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com