[Zope] Problem w/ form writing to database

Steve Spicklemire steve@spvi.com
Tue, 10 Jul 2001 11:28:08 -0500 (EST)


Yeah.. the 'name="..."' in your form needs to match the arguments in
your ZSQLMethod, or you need to explicitly use them as arguments
to you method, 

e.g., <dtml-call "newTicket(email=x, priority=y, problem=z)">

-steve

>>>>> "Terry" == Terry McKenna <terry_a_mckenna@yahoo.com> writes:

    Terry> Steve,

    Terry> Thanks for the quick response. I tried this approach.  I
    Terry> get the following error:

    Terry> Error Type: Bad Request Error Value: ['email', 'priority',
    Terry> 'problem']

    Terry> I have these variables defined as "arguments" in my Z SQL
    Terry> Method. Not sure why this is happening. Any ideas?

    Terry> --- Steve Spicklemire <steve@spvi.com> wrote:
    >>  Hi Terry,
    >> 
    >> You want the "action" of your form to be another DTML Method
    >> that calls the ZSQLMethod and then either displays some
    >> confirmation UI, or redirects to something intelligent.
    >> 
    >> e.g.,
    >> 
    >> <dtml-call newTicket>
    >> 
    >> Thanks Your Ticket has been entered!
    >> 
    >> <form action="&dtml-URL1;"> <input type="SUBMIT" value="OK!">
    >> </form>
    >> 
    >> -steve
    >> 
    >> Terry McKenna wrote:
    >> > 
    >> > I am trying to build a Help Desk Trouble Ticket > tracking
    >> system. I want to use a web based form to > allow customers to
    >> enter trouble tickets. The problem > I am having is that when I
    >> submit the form, the zope > development environment pulls up
    >> its native database > "test" form instead of making an entry in
    >> the > database. It seems I can only enter data to my > external
    >> database through the Zope "test" form.  Any > ideas?
    >> >
    >> ---------------------------------------------------
    >> > 
    >> > "submitTicket" method:
    >> > 
    >> > <form action="troubleTicket/newTicket" method="get"> >
    >> <table> > <tr> > <th align=right>Name: > <td><input type="text"
    >> name="name" size=32> > <tr> > <th align=right>Phone: >
    >> <td><input type="text" name="phone" size=10> > <tr> > <th
    >> align=right>E-Mail: > <td><input type="text" name"email"
    >> size=32> > <tr> > <th aligh=right>App: > <td><select
    >> name="app"> > <option>N/A > <option>Servie Inquiry >
    >> <option>Idea DataMart > <option>Siebel Smart Serve > <option>S4
    >> Operations > </select> > <tr> > <th aligh=right>Server: >
    >> <td><select name="server"> > <option>N/A > <option>caycom3 >
    >> <option>caycom4 > <option>caydec1 > <option>caydec2 >
    >> <option>cosclim1 > <option>cossi01 > <option>cspcom1 >
    >> <option>cspcom2 > <option>cspsie05 > <option>norsi01 >
    >> <option>omzdie06 > <option>omzsie07 > <option>omzsie09 >
    >> <option>s4reports > <option>system2 > </select> > <tr> > <th
    >> align=right>Priority: > <td><select name="pri"> > <option>4 >
    >> <option>3 > <option>2 > <option>1 > </select> > </table> >
    >> <table> > <tr> > <td> 1 = 1 hr response > <tr> > <td> 2 = 4 hr
    >> response > <tr> > <td> 3 = 24 hr response > <tr> > <td> 4 = 72
    >> hr response > </table> > <p><h4>Description of Problem:</h4> >
    >> <textarea name="description" cols="37" rows="5"> > </textarea>
    >> > <p><input type="submit" name="submit" value=" > Submit " >
    >> </form>
    >> >
    >> 
    Terry> ---------------------------------------------------------------
    >> > > Z SQL method "newTicket":
    >> > 
    >> > insert into ticket3 values > (<dtml-sqlvar ticketNum
    >> type="int" optional>, > <dtml-sqlvar name type="string">, >
    >> <dtml-sqlvar phone type="string">, > <dtml-sqlvar email
    >> type="string">, > <dtml-sqlvar app type="string">, >
    >> <dtml-sqlvar server type="string">, > <dtml-sqlvar priority
    >> type="int">, > <dtml-sqlvar problem type="string">)
    >> >
    >> 
    Terry> --------------------------------------------------------------
    >> > > submitTicket calls newTicket. I think submitTicket > passes
    >> the values entered by the user on the form to > newTicket. I
    >> thought that should be enough for > NewTicket to make an entry
    >> in the database but the > Zope "test" interface populates the
    >> screen when I hit > submit.
    >> > 
    >> > -Thanks in advance.
    >> > 
    >> > __________________________________________________ > Do You
    >> Yahoo!?  > Get personalized email addresses from Yahoo! Mail >
    >> http://personal.mail.yahoo.com/
    >> > 
    >> > _______________________________________________ > Zope
    >> maillist - Zope@zope.org >
    >> http://lists.zope.org/mailman/listinfo/zope > ** No cross posts
    >> or HTML encoding!  ** > (Related lists -
    >> > 
    >> http://lists.zope.org/mailman/listinfo/zope-announce >
    >> http://lists.zope.org/mailman/listinfo/zope-dev )


    Terry> __________________________________________________ Do You
    Terry> Yahoo!?  Get personalized email addresses from Yahoo! Mail
    Terry> http://personal.mail.yahoo.com/