Hi Massimo;

Thanks for all the help.

So I made the updates as suggested. The upshot is that currently the
tables and the pull down all show up on the same page. What I would
like to do is to have an info screen or 1st page identical to "example
28" with a pull down at the top which allows the user to select the
ticket type and then proceed to that page. How do I combine example 28
with what I have so far? Note substitute the word ticket with the word
task.


So here's what I have to date:

In the default controller (controllers/default.py):

#!/usr/bin/python
# -*- coding: utf-8 -*-
# default controlling code

# # sample index page with internationalization (T)

def index():
    form1=SQLFORM(db.FACWO_Task)
    form2=SQLFORM(db.Electrical_Task)
    form3=SQLFORM(db.Mechanical_Task)
    form4=SQLFORM(db.Plumbing_Task)

    if form1.accepts(request.vars,session):
         response.flash="form accepted!"
    elif form2.accepts(request.vars,session):
         response.flash="form accepted"
    elif form3.accepts(request.vars,session):
         response.flash="form accepted"
    elif form4.accepts(request.vars,session):
         response.flash="form accepted"
    else:
         response.flash="form is invalid!"


    return dict(form1=form1,form2=form2,form3=form3,form4=form4)

----------------------------------------------------------------------------------------------
and in the views/default/index.html there is:

<form>
<select name="task" id="task_type">
<option value="FACWO_Task">general</option>
<option value="Electrical_Task">electrical</option>
<option value="Mechanical_Task">mechanical</option>
<option value="Plumbing_Task">plumbing</option>
</select>
</form>
<div class="myform general">{{=form1}}</div>
<div class="myform electrical">{{=form2}}</div>
<div class="myform mechanical">{{=form3}}</div>
<div class="myform plumbing">{{=form4}}</div>

<script>
function hide() { $(".myform").hide(); }
$(document).ready(function(){hide();});
$("#task_type").change(function(){hide(); $('.'+$(this).val
()).slideToggle();})
</script>
------------------------------------------------------------------------------------------------------------
So currently when I click on the default.py index you see a page with
all the tables listed from top to down. You can see my desire for a
front page. So in driving example 28 I saw a vey nice screen with name
and email. So go any ideas how I could add the drop down to example 28
and then when a user selects a drop down item it will then go to the
correct form representing the db table?

Regards
Rick Hess




On Feb 19, 10:21 am, rick hess <[email protected]> wrote:
> Hi Massimo;
>
> This is great let me give it a whirl and I'll post back as to how it
> worked.
>
> RickHess
>
> On Feb 18, 7:31 pm, mdipierro <[email protected]> wrote:
>
>
>
> > here is one possible solution (may contain typos)
>
> > def index():
> >     form1=SQLFORM(db.electrical_ticket)
> >     form2=SQLFORM(dbmechanical_ticket)
> >     if form1.accepts(..): ...
> >     if form2.accepts(..):....
> >     return dict(form1=form1,form2=form2)
>
> > in view/default/index.html
>
> > <form>
> > <select name="type" id="ticket_type">
> > <option value="electical">electrical</option><option
> > value="mechanical">mechanical</option>
> > <select>
> > </form>
> > <div class="myform electrical">{{=form1}}</div>
> > <div class="myform mechanical">{{=form2}}</div>
>
> > <script>
> > function hide() { $(".myform").hide(); }
> > $(document).ready(function() { hide(); });
> > $("#ticket_type").change(function() { hide(); $('.'+$(this).val
> > ()).slideToggle(); })
> > </script>
>
> > Massimo
>
> > On Feb 18, 6:37 pm,rickhess<[email protected]> wrote:
>
> > > Guys;
>
> > > So I'm brand new to web2py but I have a need to create a web2py
> > > application that has the capability of creating trouble tickets for
> > > our physical plant/facility. For instance we'll have an electrical
> > > ticket, a plumbing ticket, a mechanical ticket etc. So far I have
> > > defined a table to represent each trouble ticket type. What I would
> > > like to do is to have a "drop down" on an introductory form that
> > > allows a user to select the trouble ticket type which will then allow
> > > the user to fill in the form for that ticket type.
>
> > > So for instance a user can select/highlight electrical ticket from the
> > > introductory screen drop down, which then brings up the electrical
> > > ticket form, fill out the electrical ticket, and then save it to the
> > > database electrical ticket table.
>
> > > So I've looked high and low through the 'WEB2PY' manual as well as
> > > this google group and can't find an example on a drop down with this
> > > kind of functionality.
>
> > > Can someone point me to an example that illustrates this kind of
> > > mechanism.
>
> > > Thanks in advance
>
> > > Regards
> > >RickHess- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to