you can either set a value of response.message in the if accepts(...)
or you can do
{{=response.message or "Say something here"}}
On Nov 26, 10:22 am, annet <[EMAIL PROTECTED]> wrote:
> Massimo,
>
> I am afraid, I did not fully understand your former reply then.
>
> This is the controller:
>
> def byplace():
> response.view='clubs/view.html'
> response.functionname=T('Club locator op plaats')
> form=FORM('Type een plaatsnaam:',
> INPUT(_name='plaatsnaam',requires=IS_NOT_EMPTY()),
> INPUT(_type='submit'))
> if form.accepts(request.vars,session):
> clubs=db((db.bedrijf.id==db.adres.bedrijf)&
> (db.bedrijf.id==db.bedrijfbranche.bedrijf)&\
> (db.adres.plaatsnaam==request.vars.plaatsnaam)&
> (db.adres.adressoort==2)&(db.bedrijfbranche.branche==2))\
> .select
> (db.bedrijf.id,db.bedrijf.bedrijfsnaam,db.bedrijf.ranking,db.adres.straatnaam,
> \
> orderby=db.bedrijf.ranking|db.bedrijf.bedrijfsnaam)
> else:
> response.message='Formuleer een zoekopdracht'
> clubs=[]
> return dict(form=form,clubs=clubs)
>
> and this the view:
>
> <div id="grid2columns">
> <div id="leftcolumn">
> {{=form}}
> {{include 'functionnavigation.html'}}
> </div> <!-- leftcolumn -->
> <div id="mainright">
> <div id="dt_example">
> {{if not clubs:}}
> <p class="message">
> {{=response.message}}
> </p> <!-- message -->
> {{else:}}
> <table id="example" class="display">
> <thead>
> <tr>
> <th>bedrijfsnaam</th>
> <th>straatnaam</th>
> </tr>
> </thead>
> <tbody>
> {{for club in clubs:}}
> <tr>
> <td>{{=A
> (club.bedrijf.bedrijfsnaam,_href=URL(r=request,f='clubdetails',
> args=[club.bedrijf.id]),_target="_blank")}}</td>
> <td>{{=club.adres.straatnaam}}</td>
> </tr>
> {{pass}}
> </tbody>
> </table>
> {{pass}}
> </div> <!-- dt_example -->
> </div> <!-- mainright -->
> </div> <!-- grid2columns -->
>
> When the page is rendered for the first time, the message in
> response.message is displayed. When the visitor enters a city and
> clicks the submit button one of two things happens: if there are clubs
> in the city the visitor entered the clubs are displayed in the table,
> if there are no clubs in the city the visitor entered the word 'none'
> is displayed. I expected response.message to be displayed instead of
> none, but it isn't. I hope providing you with the code, helps solve
> this problem.
>
> Best regards,
>
> Annet
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---