Hopefully the answer here
<https://groups.google.com/d/msg/web2py/Kmb2r__HFJo/yzWdyhY2hH0J>will
clarify things.
On Tuesday, January 20, 2015 at 7:55:30 AM UTC-5, americandewd wrote:
>
> I have a form that was created by CRUD, I also update this form by CRUD.
>
> In another thread I was told by Anthony about a "field widget" controlling
> what is seen (he stated this is for: "read-only forms, SQLTABLE,
> SQLFORM.grid, and when calling rows.render()") however per the book it says
> that to set that I must use the "Widget=XXX" option, which I have not. The
> conditions he stated do not seem to apply so what he said actually confused
> me further because I know what it is not, none of those.
>
> When I set this one thing for the form:
> formcontrol.category.writable = False
> It shows the category name but, obviously in a static field that cannot be
> changed.
>
> In addition I have been able to make it show the data that the user had
> selected by not using the exclusion list:
> catwanted = []
> notwanted = ['Dogs','Cats','MiscPets']
> for row in db(db.category).select():
> if row.title in notwanted:
> pass
> else:
> catwanted.append(row.id)
> catwanted.sort()
> and to exclude the items I use the
> "requires=IS_IN_SET(catwanted,zero=None)". When I remove the
> "requires=IS_IN_SET(catwanted,zero=None)", the dropdown list shows the
> category name for the field BUT obviously includes names I don't want.
>
> Am I not allowed to make my own exclusions for categories?
> Why when I remove the "requires=" the user is able to see the data in the
> field as expected (except that it also shows the ones I don't want them to
> see)? How do I make it so they cannot see those categories?
>
> Is there more to creating a set besides making it a list?
>
> It shows the category name as expected just not in a dropdown or editable
> input field so as to allow the user to change it.
>
> I have the form being called like this:
> form=crud.update(db.animals,animals,next=url('currentanimals'),onvalidation=my_form_processing)
>
> I just want the user to be able to see the category name they are choosing
> because I do not think it possible for them to know the ID.
>
> Is this unusual or should I provide a list of names that users can match
> up to the IDs?
>
> I do not recall other websites being that way but, I could be wrong.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.