numero = 20342
interpreted = N
texte = On 10/8/98 3:40 PM, charles kline so noted...>This looks great, only do to my lack of a Full understanding of WebCat >I was hoping you could explain your syntax a little more, if you have >time. I am not replacing with a context on the next page. This is a >straight-up replace to a database.>>Doh! Commands! : )I don't know if you had seen it a couple weeks back -- in part of a message I mentioned how I always use contexts instead of commands so I'm not as familiar with command structure (always seems to be at least three different ways of doing something with commands : )That being said, your snippet above looks on the right track except when doing a replace (as opposed to an append), you need to tell it what record you're wanting to replace. Something like:Also, you won't be able to store the checkbox information as T/F when using a command like this. If somebody checks the Swimming Pool box, T will be stored in the database, if not, [SwimmingPool] will be saved (or possibly just -- my lack of command familiarity showing again).That's one of the reasons I prefer contexts, You can do pre-processing and validity checking on information before storing it somewhere. Of course, it's not absolutely necessary to store T/F for the value. Just treat it as if it's 'T' it's true, anything else, it's false.>So I figure I will use this example that you sent along to me:>>>If your checkboxes in the form were named such as:>>>>>>>>>>>>Which means that I will change the names to start with an '_'>>I think I have that much. But then I get a little lost here:>>>then the following would add their values (as T or F) to a database:>>>>[append db=whatever.db]......[formvariables >>name=_&exact=F]&[name]=[showif [value]=T]T[/showif][showif >>[value]!T]F[/showif][/formvariables]........[/append]>>I guess this loops through the form variables and evaluatrs all that >start with '_'?Since exact=F in this example, the formvariables loop will show any passed variables that have a _ anywhere in the name. If you have other elements in the form with underscores in their names that *aren't* checkboxes you want processed in this way (I think PCS' latest example sites have underscores in front of *all* variables) you could add more characters to ensure the name would be unique, such as:and then:[replace db=xxx.db&eqSKUdata=[SKU]&append=T].....[formvariables name=_Chk&exact=F]&[name]=[showif [value]=T]T[/showif][showif [value]!T]F[/showif][/formvariables][/replace]Note the changes to make the replace work like the command version. Now, if the SKU that's being passed is generated by [DATE %m%d%y][TIME %H%M%S] this context will *always* function as an append, since no matches for SKU will ever be found, except on The Day The Earth Stood Still.>This is going to replace my existing append? I am not sure how to >implement this on my page. I know that this is just a snippit, but seeing >what I already have from above, where does this go?If you're using a context like this, you'd remove all command references from your form and place the context (the [replace] line shown above) into your add1.tpl page>Thanks very much for your reply. I beleive this is exactly what I want to >do, just not 100% on the how-to part.Hopefully this makes it a *little* clearer (and not more confusing : )Rob MarquardtDesigner/Resident WireheadToast Design300 First Avenue North, Suite 150Minneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com
Associated Messages, from the most recent to the oldest:
On 10/8/98 3:40 PM, charles kline so noted...>This looks great, only do to my lack of a Full understanding of WebCat >I was hoping you could explain your syntax a little more, if you have >time. I am not replacing with a context on the next page. This is a >straight-up replace to a database.>>Doh! Commands! : )I don't know if you had seen it a couple weeks back -- in part of a message I mentioned how I always use contexts instead of commands so I'm not as familiar with command structure (always seems to be at least three different ways of doing something with commands : )That being said, your snippet above looks on the right track except when doing a replace (as opposed to an append), you need to tell it what record you're wanting to replace. Something like:Also, you won't be able to store the checkbox information as T/F when using a command like this. If somebody checks the Swimming Pool box, T will be stored in the database, if not, [SwimmingPool] will be saved (or possibly just -- my lack of command familiarity showing again).That's one of the reasons I prefer contexts, You can do pre-processing and validity checking on information before storing it somewhere. Of course, it's not absolutely necessary to store T/F for the value. Just treat it as if it's 'T' it's true, anything else, it's false.>So I figure I will use this example that you sent along to me:>>>If your checkboxes in the form were named such as:>>>>>>>>>>>>Which means that I will change the names to start with an '_'>>I think I have that much. But then I get a little lost here:>>>then the following would add their values (as T or F) to a database:>>>>[append db=whatever.db]......[formvariables >>name=_&exact=F]&[name]=[showif [value]=T]T[/showif][showif >>[value]!T]F[/showif][/formvariables]........[/append]>>I guess this loops through the form variables and evaluatrs all that >start with '_'?Since exact=F in this example, the formvariables loop will show any passed variables that have a _ anywhere in the name. If you have other elements in the form with underscores in their names that *aren't* checkboxes you want processed in this way (I think PCS' latest example sites have underscores in front of *all* variables) you could add more characters to ensure the name would be unique, such as:and then:[replace db=xxx.db&eqSKUdata=[SKU]&append=T].....[formvariables name=_Chk&exact=F]&[name]=[showif [value]=T]T[/showif][showif [value]!T]F[/showif][/formvariables][/replace]Note the changes to make the replace work like the command version. Now, if the SKU that's being passed is generated by [DATE %m%d%y][TIME %H%M%S] this context will *always* function as an append, since no matches for SKU will ever be found, except on The Day The Earth Stood Still.>This is going to replace my existing append? I am not sure how to >implement this on my page. I know that this is just a snippit, but seeing >what I already have from above, where does this go?If you're using a context like this, you'd remove all command references from your form and place the context (the [replace] line shown above) into your add1.tpl page>Thanks very much for your reply. I beleive this is exactly what I want to >do, just not 100% on the how-to part.Hopefully this makes it a *little* clearer (and not more confusing : )Rob MarquardtDesigner/Resident WireheadToast Design300 First Avenue North, Suite 150Minneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com
Rob Marquardt
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...