Shhh, very quiet.
This WebDNA talk-list message is from 2006
It keeps the original formatting.
numero = 66887
interpreted = N
texte = Hello,Its been purty quiet lately so I thought I'd post something.Now some/many? of you probably do this already.. so this is for peoplewho haven't tried this yet.When interacting with a database, there is almost alwaysan ADD, EDIT and DELETE system to build right? Concentratingon just the ADD and EDIT... I use to create two lengthyforms. The edit form auto filled in the form, theadd form didn't.For quite some time now, I've been using only one form combinedwith a append=T in a replace.Here is how it works:1.) If you are adding. Just link to the page.2.) if You are editing.. link to the page with the ID of the record to be edited using "theID".** this assumes that a database will have a unique fieldname (in this case "ID") **3.) Put this code in the top of the page:[if ("[raw][theID][/raw]"="[theID]") | ("[raw][theID][/raw]"="")] [then] [ListFields db=thedb.db][text][name]=[/text][/listfields] [/then] [else] [search db=thedb.db&eqIDdatarq=[theID]] [founditems] [ListFields db=thedb.db][text][fieldname]=[interpret][[fieldname]][/interpret][/text][/listfields] [/founditems] [/search] [/else][/if]4.) This is your add or edit form (I like to have it in an .inc file)
5. ) Put your edit code at the top of the page even above the "IF Then else".[showif [url][action][/url]=addedit] [showif ||[raw]|theID][/raw]|^|[theID]|] [!] **globalid.db is a database with only one field name called "ID" **It is the best way I've found to asign a unique ID safely to allow growth. [/!] [exclusivelock db=globalid.db] [append db=globalID.db&autonumber=ID][/append] [/exclusivelock] [/showif] [exclusivelock db=thedb.db] [replace db=thedb.db&eqIDdatarq=[theID]&append=T][!] [/!]ID=[lastautonumber]&[!] [/!][formvariables name=__&exact=F][!] [/!][getchars start=3][name][/getchars]=[url][value][/ur]&[!] [/!][/formvariables][!] [/!][/replace] [/exclusivelock] [commitdatabase db=thedb.db][/showif]6.) I wrote this quickly and spontaneously for this email so therecould very well be syntax and spelling problems!This will save you much time in only having to edit oneform when there are changes to a database... not only that,but you don't have to edit the replace and search contexts!Cheers,Donovan-- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o DONOVAN D. BROOKE EUCA Design Center <- Web Development (specializing in eCommerce),-> <- Custom Paint, Labels, and Specialty Signage. -> <- Home and Business Embellishment/Fabrication, -> <- Glass Blowing, and Art Glass -> PH/FAX:> 1 (608) 835-2476 Web:> http://www.egg.bz | http://www.euca.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Hello,Its been purty quiet lately so I thought I'd post something.Now some/many? of you probably do this already.. so this is for peoplewho haven't tried this yet.When interacting with a database, there is almost alwaysan ADD, EDIT and DELETE system to build right? Concentratingon just the ADD and EDIT... I use to create two lengthyforms. The edit form auto filled in the form, theadd form didn't.For quite some time now, I've been using only one form combinedwith a append=T in a replace.Here is how it works:1.) If you are adding. Just link to the page.2.) if You are editing.. link to the page with the ID of the record to be edited using "theID".** this assumes that a database will have a unique fieldname (in this case "ID") **3.) Put this code in the top of the page:[if ("[raw][theID][/raw]"="[theID]") | ("[raw][theID][/raw]"="")] [then] [ListFields db=thedb.db][text][name]=[/text][/listfields] [/then] [else] [search db=thedb.db&eqIDdatarq=[theID]] [founditems] [ListFields db=thedb.db][text][fieldname]=[interpret][[fieldname]][/interpret][/text][/listfields] [/founditems] [/search] [/else][/if]4.) This is your add or edit form (I like to have it in an .inc file)5. ) Put your edit code at the top of the page even above the "IF Then else".[showif [url][action][/url]=addedit] [showif ||[raw]|theID][/raw]|^|[theID]|] [!] **globalid.db is a database with only one field name called "ID" **It is the best way I've found to asign a unique ID safely to allow growth. [/!] [exclusivelock db=globalid.db] [append db=globalID.db&autonumber=ID][/append] [/exclusivelock] [/showif] [exclusivelock db=thedb.db] [replace db=thedb.db&eqIDdatarq=[theID]&append=T][!] [/!]ID=[lastautonumber]&[!] [/!][formvariables name=__&exact=F][!] [/!][getchars start=3][name][/getchars]=[url][value][/ur]&[!] [/!][/formvariables][!] [/!][/replace] [/exclusivelock] [commitdatabase db=thedb.db][/showif]6.) I wrote this quickly and spontaneously for this email so therecould very well be syntax and spelling problems!This will save you much time in only having to edit oneform when there are changes to a database... not only that,but you don't have to edit the replace and search contexts!Cheers,Donovan-- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o DONOVAN D. BROOKE EUCA Design Center <- Web Development (specializing in eCommerce),-> <- Custom Paint, Labels, and Specialty Signage. -> <- Home and Business Embellishment/Fabrication, -> <- Glass Blowing, and Art Glass -> PH/FAX:> 1 (608) 835-2476 Web:> http://www.egg.bz | http://www.euca.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Donovan Brooke
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
formatting a number (1999)
Re(6): Small Bug: ErrorLog.txt/[FORMVARIABLES]/[ORDERFILE] (1998)
Large databases in WebCat (1997)
WebCatalog Hosting (1998)
Everyone: List Traffic (was [include ...] behavior) (1997)
Another question (1997)
Problems with [Applescript] (1997)
[OT] Bad Hard Drive? (2003)
email preferences on NT (1997)
Quantity * price (1997)
REPOST: Overwiting SKU in Cart (2002)
Max Record length restated as maybe bug (1997)
spawn (1998)
Followup question re: checksum for credit cards? (1997)
Running _every_ page through WebCat ? (1997)
process SSI (1998)
Emailer Question (1998)
can webcat determine an image's pixel dimensions? (2000)
Multiple prices (1997)
WebCatalog can't find database (1997)