
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] SQL insert with a form - SOLVED
Thank you for your help. I still have not been able to get the mv_function_data
fields to work. But, since my real problem was the single quotes in my form
fileds, the fix was setting a filter.
This is what I did that worked:
On my form I had all the normal form fileds with my next page doing all the work
<FORM ACTION="[process-target]" METHOD=POST NAME="main">
<input type=hidden name=mv_session_id value="[data session id]">
<INPUT TYPE=hidden NAME=mv_todo VALUE=return>
<INPUT TYPE=hidden NAME=mv_nextpage VALUE="serviceticket-sent.html">
Here's the Next page:
[query sql="INSERT INTO Tkt SET RequestDetails='[value name=RequestDetails
filter=sql]',customerName='[value customerName]', submittedBy='[value
submittedBy]', timeTkt='[value timeTkt]';"]
The "filter=sql" within the value tag was the answer.
Thanks,
Dorothy
Ed LaFrance wrote:
> At 09:40 AM 11/20/2001 -0800, you wrote:
> >My database actually does an autoincrement on the Primary Key field, which
> >works
> >fine when I use the
> >[query sql="INSERT INTO Tkt SET customerName='[value customerName]',
> >HelpDeskNum='[value HelpDeskNum]',serviceDate='[value serviceDate]',
> >LocationWork='[value LocationWork]', AfterHours='[value AfterHours]'"]
> >command.
>
> Yep, but with form-based update, IC has to see valid data for the key value
> *in the form* or it will fail right off.
>
> >I have tried adding the primary key in the "mv_data_fields":
> >
> ><INPUT TYPE=HIDDEN NAME="mv_data_fields"
> >VALUE="tktnum,customerName,HelpDeskNum,serviceDate,LocationWork,AfterHours,
> >servicePerformed,host,domain">
> >
> >and having an input field with the tktnum, but I still get the error.
> >
> >Ticket Number: <INPUT NAME="tktnum" SIZE=30 >
> >
> >What I really want to do is escape out the sinqle quotes out of my test
> >before it
> >gets written to the database, as the single quotes cause an SQL error. Any
> >ideas??
>
> I'm not sure I understand that. You can use filters on form inputs and on
> 'memory' values, so in either case it seems you should be able to condition
> the data as needed - read up on the [filter] tag and form-based filters.
>
> If you want to use a form to directly write to the SQL table, use the
> [counter] tag to generate a unique key number, instead of the
> auto_increment field type.
>
> - Ed L.
>
> >Thanks,
> >Dorothy
> >
> >Ed LaFrance wrote:
> >
> > > At 03:33 PM 11/19/2001 -0800, you wrote:
> > > >I have gone over the mailing lists and the docs on how to insert into a
> > > >table with a form. I have followed the instructions for UPDATING a
> > > >database
> > > >with a form at:
> > > >http://interchange.redhat.com/cgi-bin/ic/docfly.html?mv_arg=ictemplates
> > 10%2e09,
> > > >but I get an "Attempted database update without
> > > >permission". Searching through the maillist, the answer to that question
> > > >is to have mv_data_enable set to 1, which I do, and I still get nothing.
> > > >Below
> > > >is what I have in my form, can someone PLEASE help me.
> > > >
> > > >Thank you,
> > > >Dorothy Puma
> > > >
> > > >[set mv_data_enable]1[/set]
> > > ><FORM METHOD=POST ACTION="[process-target]">
> > > ><INPUT TYPE=HIDDEN NAME="mv_nextpage" VALUE="serviceticket2-sent">
> > > ><INPUT TYPE=HIDDEN NAME="mv_data_table" VALUE="Tkt">
> > > ><INPUT TYPE=HIDDEN NAME="mv_data_key" VALUE="tktnum">
> > > ><INPUT TYPE=HIDDEN NAME="mv_data_function" VALUE="insert">
> > > ><INPUT TYPE=HIDDEN NAME="mv_data_fields"
> > > >VALUE="customerName,HelpDeskNum,serviceDate,LocationWork,AfterHours,
> > > >servicePerformed,host,domain">
> > > ><INPUT TYPE=hidden NAME="mv_todo" VALUE="set">
> > > >_______________________________________________
> > >
> > > FWIW - You are missing:
> > >
> > > <input type=your_choice name=tktnum value="a_key_id">
> > >
> > > - Ed L.
> > >
> > > ===============================================================
> > > New Media E.M.S. Software Solutions for Business
> > > 463 Main St., Suite D eCommerce | Consulting | Hosting
> > > Placerville, CA 95667 edl@newmediaems.com
> > > (530) 622-9421 http://www.newmediaems.com
> > > (866) 519-4680 Toll-Free (530) 622-9426 Fax
> > > ===============================================================
> > >
> > > _______________________________________________
> > > interchange-users mailing list
> > > interchange-users@interchange.redhat.com
> > > http://interchange.redhat.com/mailman/listinfo/interchange-users
> >
> >_______________________________________________
> >interchange-users mailing list
> >interchange-users@interchange.redhat.com
> >http://interchange.redhat.com/mailman/listinfo/interchange-users
>
> ===============================================================
> New Media E.M.S. Software Solutions for Business
> 463 Main St., Suite D eCommerce | Consulting | Hosting
> Placerville, CA 95667 edl@newmediaems.com
> (530) 622-9421 http://www.newmediaems.com
> (866) 519-4680 Toll-Free (530) 622-9426 Fax
> ===============================================================
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users