Jose, if I understand correctly you don't want to show the drop down
with the options from the IS_IN_SET.
You can do this by changing the input widget of the field:
db.my_table.my_field.widget=lambda self,value:
INPUT(_type='text', _id='%s_%s' %(self._tablename,self.name),
_class=self.type,_name=self.name,value='')
so now it will be displayed as a simple input in the form.
The requires stays the same to validate the user's reply.
Denes.
On Apr 20, 7:15 pm, Jose <[email protected]> wrote:
> On 20 abr, 17:22, Jose <[email protected]> wrote:
>
>
>
> > On 20 abr, 15:39, mdipierro <[email protected]> wrote:
>
> > > please post a complete controller that exhibits the problem.
>
> > > Massimo
>
> > import applications.myapplication.modules.textchas as textchas
> > ...
> > def my_controller():
> > form=SQLFORM(db.my_table)
> > if session.tch == None:
> > session.tch = textchas.get_tch()
>
> > tch = session.tch
> > form[0].insert(len(form[0])-1, TR('Validate:', tch[0], ''))
> > form[0].insert(len(form[0])-1, TR('', INPUT(_name='tcha', requires=
> > [IS_IN_SET(tch[1])]), ''))
> > if form.accepts(request.vars,session):
> > session.tch = None
> > response.flash='form accepted'
>
> > return dict(form=form)
>
> > This works well, does what I hope that it does, only that sends the
> > possible answers to the client.
> > As I said before, if from the browser I see the source code of the
> > page, there the answers are.
>
> > Get_tch () returns a tupla where the first element in a string
> > (question), and the second a list of strings (the answers).
>
> > Jose
>
> This one is a sample of the code html generated. In this case there
> are three possible answers.
>
> <div class="hidden" id="session">
> <h2>session</h2>
> <div>
> <table>
> <tr>
> <td><b><div>tch</div></b></td>
> <td align="top">:</td>
> <td>
> <div>
> <table>
> <tr>
> <td><div>Question?</div></td>
> </tr>
> <tr>
> <td>
> <div>
> <table>
> <tr>
> <td><div>answer1</div></td>
> </tr>
> <tr>
> <td><div>answer2</div></td>
> </tr>
> <tr>
> <td><div>answer3</div></td>
> </tr>
> </table>
> </div>
> </td>
> </tr>
> </table>
> </div>
> </td>
> </tr>
> </table>
> </div>
> </div>
>
> With which in the side of the client already the response is known.
>
> Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---