navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

checkboxes in DRW update

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> checkboxes in DRW update
Page: [1]
 
sarge

 

Posts: 379
From: London England
Status: offline

 
checkboxes in DRW update - 12/11/2001 19:26:59   
I have a database of Trader details, that get displayed on the site.
I want the Traders to maintain their own details (such as change of address etc.).
For this purpose, I' ve set up a form on which the traders can change their details.
The form is embedded in a DRW that brings up the details for a named trader, and initial values for textboxes on the form are set using <%=FP_FieldVal(fp_rs," xxxxx" )%>, and these values are set for each textbox.
The trader makes his changes to these displayed values, and submits (POSTs) the form to a DRW page containing an update query. This update page has a custom query in step 2, of the format:
UPDATE DISTINCTROW trader SET
trad_addr1=' ::addr1::' ,
trad_addr2=' ::addr2::' ,
trad_addr3=' ::addr3::' ,
trad_postcode=' ::postcode::' ,
trad_phone=' ::phone::'
WHERE userid=' ::userid::'
This all works beautifully. Easy-peazy.

The trouble is that the form also contains 20 checkboxes. (These indicate the type of business that the trader does, such as repairs, sales, etc.) On the form, I set initial values for the checkboxes using <%If FP_FieldURL(fp_rs," trad_xxxxx" ) = " True" then response.write " checked" %>, and this is done for each checkbox.
When a trader then changes his textbox settings and submits the form, I should be able to apply the changes in the same way as above:
UPDATE DISTINCTROW trader SET
trad_repairs=::repair:: etc...
But it won' t. I' ve tried it every which way, and I' ve combed the archives, but I can' t find the correct syntax. Is there a correct syntax, or must I have a re-think? Any ideas?
Thanks,
Sarge

 

< Message edited by Spooky -- 8/21/2002 5:30:23 PM >
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: online

 
RE: checkboxes in DRW update - 12/11/2001 21:43:50   
Check out :

http://www.outfront.net/spooky/advanced.htm#input


< Message edited by Spooky -- 8/21/2002 5:30:45 PM >


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to sarge)
sarge

 

Posts: 379
From: London England
Status: offline

 
RE: checkboxes in DRW update - 12/12/2001 7:40:35   
Hi Spooky-
What I had not realised was that the default value of Null MUST be inserted for it to work (even though the checkboxes are always present). Once I put that in, it all worked beautifully. Orgasmic!
Cheers,
Sarge

 

(in reply to sarge)
d00nson

 

Posts: 142
From: Australia
Status: offline

 
RE: checkboxes in DRW update - 12/12/2001 16:50:21   
Hmm....I love this forum!!
I'm having the same prob as Sarge, but having traced his footsteps, I am finding that I still have the same problem. First of all, is there a reason I can't set the default value to "True" instead of "Null" in the table design? I sometimes edit the table directly and it's just a matter of convenience. Secondly, when updating the table thru DRW, everything's sweet until I decide to uncheck the box. To which the DRW responds by saying:

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query.

My update string is:

UPDATE DISTINCTROW products
SET
pid='::pid::',
brand='::brand::',
model='::model::',
show=::show::,
description='::description::',
image='::image::',
price=::price::
WHERE ID=::ID::

All are text fields except show (booleen) and ID (autonumber)
Thanks in advance!!


(in reply to sarge)
sarge

 

Posts: 379
From: London England
Status: offline

 
RE: checkboxes in DRW update - 12/12/2001 18:15:13   
I assume you meant to include price as non-text...?
In the past, when all else has failed for True/False or Yes/NO or whathaveyou, I've used the actual values of -1 (minus one) for true, and 0 (zero) for false, and this usually gets me out of trouble.
-Sarge

 

(in reply to sarge)
d00nson

 

Posts: 142
From: Australia
Status: offline

 
RE: checkboxes in DRW update - 12/13/2001 1:55:31   
Thanks Sarge, however, the problem doesn't seem to be with the Access table itself, but the value being submitted to the update.asp page from my form page. What I have done is instead of displaying -1 or 0 in a textbox for the booleen field, I have used (code follows)
<input type="checkbox" name="show" <%If lCase(FP_FieldVal(fp_rs,"show"))="true" then response.write "checked"%> value="0">

Because this is a UPDATE form that pulls the existing record from the database and if the original value was "on/true/-1" then it would check the checkbox.
The problem is if I decide I want to uncheck a record that has it's value set to "on/true/-1", when I click submit to send the form data to the code that does the updating, the form is passing a blank value to the update code.


(in reply to sarge)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> checkboxes in DRW update
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts