Re: 3.0 [TEXT] variables

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 20496
interpreted = N
texte = >From my experience, it looks like you cannot override any special tag (ie [cart] or [date]) or any form variables by setting a text variable with the same name.This made sense in the early beta implementation of [text], because you could only access text variables variables inside a [text] context. But since the final version allows you to access a text variable just like a tag or form variable, it would seem that there should only be one item by any given name in a single template, and that you should be able to use [text] to change its value.The ability to use [text] to alter the values stored in form variables would have many potential applications, as does your idea for assigning new cart numbers. The potential for advanced forms-validation alone makes my head spin: form input could be cleaned up once, at the top of a template, eliminating the need to do all sorts of multiple data checks that currently litter many a template.A simple example would be a form with several checkboxes. Currently there is a lot of code out there that deals with it like this: [Append ...]CheckBox1=[ShowIf [CheckBox1]=[raw][CheckBox1][/raw]]F[/ShowIf][HideIf [CheckBox1]=[raw][CheckBox1][/raw]][CheckBox1]&CheckBox2=[ShowIf [CheckBox2]=[raw][CheckBox2][/raw]]F[/ShowIf][HideIf [CheckBox2]=[raw][CheckBox2][/raw]][CheckBox2][/Append]Every time you want to use a checkbox value, you have to go through the whole [ShowIf]/[HideIf] routine again. What a drag. If you could filter the results using [text], this could become: [ShowIf [CheckBox1]=[raw][CheckBox1][/raw]][text]CheckBox1=F[/text][/ShowIf] [ShowIf [CheckBox2]=[raw][CheckBox2][/raw]][text]CheckBox2=F[/text][/ShowIf] ... [Append ...]CheckBox1=[CheckBox1]&CheckBox2=[CheckBox2][/Append]In this manner, you could separate the form validation functions from the rest of the template, making it much easier to write, maintain, and understand the core functionality of your code. As an added bonus, complex templates would probably get a bit of a performance boost (not having to process lot of extra [ShowIf]/[HideIf]s, etc).There may be some good reasons that it doesn't work this way, but I'd be interested to hear thoughts from PCS and other list members on this...-DaveAt 5:39 PM 10/15/98, Michael Winston wrote: >I've noticed that > >[TEXT SHOW=F]CART=HELLO[/TEXT] >[TEXT]CART[/TEXT]
>[CART] > >Returns: > >HELLO >29843784784 > >I understand that [CART] is a special tag, but I was kind of hoping that I >could take advantage of the new variable capabilites to assign new cart >numbers on the fly (thus making my oft requested [NEWCART] tag obsolete). > >Is this a bug, or should I not hold my breath waiting for this to change? >It's not hard to code around, but I'd like to plan my strategy early. > >Michael > >Michael Winston *By e-mail!: michaelw@dhorse.com >Senior Web Developer *By web!: http://www.dhorse.com/ >Dark Horse Comics, Inc. *By fax!: 503/654/9440 o--------------- Dave MacLeay --+ o----------- Digital Frontier --+ o--------------- 802.253.8612 --+ o--- dave@digitalfrontier.com --+ Associated Messages, from the most recent to the oldest:

    
  1. Re: 3.0 [TEXT] variables (Kenneth Grome 1998)
  2. Re: 3.0 [TEXT] variables (Grant Hulbert 1998)
  3. Re: 3.0 [TEXT] variables (Christer Olsson 1998)
  4. Re: 3.0 [TEXT] variables (Michael Winston 1998)
  5. Re: 3.0 [TEXT] variables (Grant Hulbert 1998)
  6. Re: 3.0 [TEXT] variables (Rob Marquardt 1998)
  7. Re: 3.0 [TEXT] variables (Dave MacLeay 1998)
  8. 3.0 [TEXT] variables (Michael Winston 1998)
>From my experience, it looks like you cannot override any special tag (ie [cart] or [date]) or any form variables by setting a text variable with the same name.This made sense in the early beta implementation of [text], because you could only access text variables variables inside a [text] context. But since the final version allows you to access a text variable just like a tag or form variable, it would seem that there should only be one item by any given name in a single template, and that you should be able to use [text] to change its value.The ability to use [text] to alter the values stored in form variables would have many potential applications, as does your idea for assigning new cart numbers. The potential for advanced forms-validation alone makes my head spin: form input could be cleaned up once, at the top of a template, eliminating the need to do all sorts of multiple data checks that currently litter many a template.A simple example would be a form with several checkboxes. Currently there is a lot of code out there that deals with it like this: [Append ...]CheckBox1=[ShowIf [CheckBox1]=[raw][CheckBox1][/raw]]F[/ShowIf][HideIf [CheckBox1]=[raw][CheckBox1][/raw]][CheckBox1]&CheckBox2=[ShowIf [CheckBox2]=[raw][CheckBox2][/raw]]F[/ShowIf][HideIf [CheckBox2]=[raw][CheckBox2][/raw]][CheckBox2][/Append]Every time you want to use a checkbox value, you have to go through the whole [showif]/[hideif] routine again. What a drag. If you could filter the results using [text], this could become: [ShowIf [CheckBox1]=[raw][CheckBox1][/raw]][text]CheckBox1=F[/text][/ShowIf] [ShowIf [CheckBox2]=[raw][CheckBox2][/raw]][text]CheckBox2=F[/text][/ShowIf] ... [Append ...]CheckBox1=[CheckBox1]&CheckBox2=[CheckBox2][/Append]In this manner, you could separate the form validation functions from the rest of the template, making it much easier to write, maintain, and understand the core functionality of your code. As an added bonus, complex templates would probably get a bit of a performance boost (not having to process lot of extra [showif]/[hideif]s, etc).There may be some good reasons that it doesn't work this way, but I'd be interested to hear thoughts from PCS and other list members on this...-DaveAt 5:39 PM 10/15/98, Michael Winston wrote: >I've noticed that > >[TEXT SHOW=F]CART=HELLO[/TEXT] >[text]CART[/TEXT]
>[cart] > >Returns: > >HELLO >29843784784 > >I understand that [cart] is a special tag, but I was kind of hoping that I >could take advantage of the new variable capabilites to assign new cart >numbers on the fly (thus making my oft requested [NEWCART] tag obsolete). > >Is this a bug, or should I not hold my breath waiting for this to change? >It's not hard to code around, but I'd like to plan my strategy early. > >Michael > >Michael Winston *By e-mail!: michaelw@dhorse.com >Senior Web Developer *By web!: http://www.dhorse.com/ >Dark Horse Comics, Inc. *By fax!: 503/654/9440 o--------------- Dave MacLeay --+ o----------- Digital Frontier --+ o--------------- 802.253.8612 --+ o--- dave@digitalfrontier.com --+ Dave MacLeay

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:

corrupted jpgs (2003) How far do [showif]s go? (1997) [WebDNA] limit found per row (2011) bye bye tax rate (1998) ConvertChars (1998) Include vs. lookup? (1998) missing records (1998) TCPConnect & Post (2002) Requiring that certain fields be completed (1997) mySQL numfound (2006) Another option (2005) WebCat2: Items xx to xx shown, etc. (1997) RE: redirect with more than 256 characters (1999) Sku numbers (1997) Blank orders after update to 5.1 (2003) A Global Variable (1997) Another bug to squash (WebCat2b13 Mac .acgi) (1997) SQL db type (2006) Which Pref is faster? (1998) no global [username] or [password] displayed ... (1997)