dexterity z3c.form field readonly

classic Classic list List threaded Threaded
4 messages Options
Vranesic Ogi Vranesic Ogi
Reply | Threaded
Open this post in threaded view
|

dexterity z3c.form field readonly

Hi

We had created custom EditForm by our dexterity content type.
And it works with the method updateWidget to change e.g. size of widgets.
However we don't know how to set a field as readonly.

Thanks in advance for every hint
Ogi

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
andreasma andreasma
Reply | Threaded
Open this post in threaded view
|

Re: dexterity z3c.form field readonly

Hi,

Am 18.01.2013 18:30, schrieb ogi vranesic:
> Hi
>
> We had created custom EditForm by our dexterity content type.
> And it works with the method updateWidget to change e.g. size of widgets.
> However we don't know how to set a field as readonly.
>
> Thanks in advance for every hint
> Ogi
>
if you created a Dexterity content type with form fields you could set a
field like in this example to read only:


    form.mode(title_declaration_legal='display')
    title_declaration_legal=schema.TextLine(
        title=_(u""),
        required=False
    )

The first line does the trick.

HTH
Andreas

--
## Developer LibreOffice
## Freie Office-Suite für Linux, Mac, Windows
## http://LibreOffice.org
## Support the Document Foundation (http://documentfoundation.org)
## Meine Seite: http://www.amantke.de 
z3c


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Vranesic Ogi Vranesic Ogi
Reply | Threaded
Open this post in threaded view
|

Re: dexterity z3c.form field readonly

On 18.01.2013 18:55, Andreas Mantke wrote:
Hi,

Am 18.01.2013 18:30, schrieb ogi vranesic:
Hi

We had created custom EditForm by our dexterity content type.
And it works with the method updateWidget to change e.g. size of widgets.
However we don't know how to set a field as readonly.

Thanks in advance for every hint
Ogi

if you created a Dexterity content type with form fields you could set a
field like in this example to read only:


    form.mode(title_declaration_legal='display')
    title_declaration_legal=schema.TextLine(
        title=_(u""),
        required=False
    )

The first line does the trick.

HTH
Andreas

Thanks Andreas for your reply

Now is field readonly also by adding new item.
But we wish in our custom editform to set it readonly, after the item has been created,
so the field can not be changed any more.
I think that must be done in the method update of our custom EditForm derived from dexterity.EditForm, but I don't know exactly how to do it.

Thanks in advance for any instruction.
Ogi



------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Vranesic Ogi Vranesic Ogi
Reply | Threaded
Open this post in threaded view
|

Re: dexterity z3c.form field readonly - SOLVED

Thanks Andreas again

It is solved now. On the basis of your answer it is obviously that in method updateWidgets
using
self.widgets['field_name'].mode = 'display'
it works now.


On 22.01.2013 16:43, ogi vranesic wrote:
On 18.01.2013 18:55, Andreas Mantke wrote:
Hi,

Am 18.01.2013 18:30, schrieb ogi vranesic:
Hi

We had created custom EditForm by our dexterity content type.
And it works with the method updateWidget to change e.g. size of widgets.
However we don't know how to set a field as readonly.

Thanks in advance for every hint
Ogi

if you created a Dexterity content type with form fields you could set a
field like in this example to read only:


    form.mode(title_declaration_legal='display')
    title_declaration_legal=schema.TextLine(
        title=_(u""),
        required=False
    )

The first line does the trick.

HTH
Andreas

Thanks Andreas for your reply

Now is field readonly also by adding new item.
But we wish in our custom editform to set it readonly, after the item has been created,
so the field can not be changed any more.
I think that must be done in the method update of our custom EditForm derived from dexterity.EditForm, but I don't know exactly how to do it.

Thanks in advance for any instruction.
Ogi




------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d


_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users