Re: Form and Context Searching -Hideif/Showif

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 33411
interpreted = N
texte = Chas see below-chas wrote:> Thanks John... > > I want a single search.tpl to work 2 ways -- as a form search with user input or as a search list... > > Search 1::: > > I'm allowing searching with a group of fields in a form: >
> > > > > > Descriptions and by Title: > > also from this same search.tpl I'm creating a list of links: > > Search 2::: > > [search db=products.db&geSKUdata=0&majorTypesumm=t&asmajorTypesort=1] > [foundItems] > [majorType]
> [/foundItems] > [/search] > > both go to one results.tpl > > the showif below works fine for the search context half (courtesy of my pal, John Butler):-)> > > [showif [url][group1field][/url]=[url][raw][group1field][/raw][/url]] > [search context stuff] > [showif] > and > [hideif [url][group1field][/url]=[url][raw][group1field][/raw][/url]] > [founditems] > from form search > [/founditems] > [hideif] > > Question 1. Why does this work?? This hides the search context and tables fine. Is it that an input field will only = itself in a [raw] form when it is *nothing*[someVar] on a template displays the value of the variable 'someVar', IF that variable *has* a value (coming from a formvariable, webcat context value, etc). If it does not have a value then the literal text [someVar] will display. Webcat engineers made it that way in case you actually were not thinking of variables and really did want to simply display [whatever]. [raw]...[/raw] wrapped around any webcat code will cause that webcat code NOT to get evaluated and instead to simply display as literal text. Soooo now go see if you can see why your new [showif] and [hideif] work. Imagine what happens in that [showif] when [group1field] has a value and when [group1field] does not. When it does you replace [group1field] with the literal value and then evaluate the rest. Remember that webcat evaluates from the inside out. Start with [group1field] and then evaluate the whole chunk by factoring in the effects of [url]...[/url]. Lastly figure out how the [showif] then decides whether or not to show its contents. Look up any of those contexts which you have not totally memorized by now. Hint::: if [group1field] does NOT have a value (and doesn't think it is a blank db field), then [url][group1field][/url]=%5Bgroup1field%5D. Study the docs on [url] until you can see why. [url][raw][group1field][/raw][/url]=%5Bgroup1field%5D. *Always*. Study the docs on [url] and [raw] until you can see why. Got it now? ;-)> > > Question 2. When I use the form search i have text on the results.tpl to this effect. > > The search for CDTitle+Type+Category found 4 items > > which was > > The search for [group1field] found [numfound] items. > > Is there a way to get the value of group1field to display?Notice this part of your form::: Descriptions and by Title:Group1Field=CDTitle+Type+Category (if your display [Group1Field], then it should be obvious that you will get CDTitle+Type+CategoryIf you want to display what the user input, then display [woGroup1data].> > > Many Thanks > > Charley Conquest > Fresh Music > > --- You wrote: > When the var value is *not* coming from a db- > > [showif [url][someVar][/url]=[url][raw][someVar][/raw][/url]] > someVar has not been given a value > [/showif] > > It would work without the [url] wrappers so long as the input never included any comparison chars, which you generally cannot be sure of. > > **** > > When the var value *is* coming from a db- > > [showif [url][someVar][/url]=] > the field someVar of this record of this db has a literal value of *nothing* > [/showif] > > It would work without the [url] wrappers so long as the field value never included any comparison chars, which you might not be sure of. > > -John > > chas wrote: > > > And.... how do you test for empty/not empty??? > > > --- end of quote --- > > ------------------------------------------------------------- > 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://search.smithmicro.com/ ------------------------------------------------------------- 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://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Form and Context Searching -Hideif/Showif (John Butler 2000)
  2. Form and Context Searching -Hideif/Showif (chas@valley.net (chas) 2000)
Chas see below-chas wrote:> Thanks John... > > I want a single search.tpl to work 2 ways -- as a form search with user input or as a search list... > > Search 1::: > > I'm allowing searching with a group of fields in a form: > > > > > > > Descriptions and by Title: > > also from this same search.tpl I'm creating a list of links: > > Search 2::: > > [search db=products.db&geSKUdata=0&majorTypesumm=t&asmajorTypesort=1] > [founditems] > [cart]&type=[url][majorType][/url]&startat=1>[majorType]
> [/foundItems] > [/search] > > both go to one results.tpl > > the showif below works fine for the search context half (courtesy of my pal, John Butler):-)> > > [showif [url][group1field][/url]=[url][raw][group1field][/raw][/url]] > [search context stuff] > [showif] > and > [hideif [url][group1field][/url]=[url][raw][group1field][/raw][/url]] > [founditems] > from form search > [/founditems] > [hideif] > > Question 1. Why does this work?? This hides the search context and tables fine. Is it that an input field will only = itself in a [raw] form when it is *nothing*[someVar] on a template displays the value of the variable 'someVar', IF that variable *has* a value (coming from a formvariable, webcat context value, etc). If it does not have a value then the literal text [someVar] will display. Webcat engineers made it that way in case you actually were not thinking of variables and really did want to simply display [whatever]. [raw]...[/raw] wrapped around any webcat code will cause that webcat code NOT to get evaluated and instead to simply display as literal text. Soooo now go see if you can see why your new [showif] and [hideif] work. Imagine what happens in that [showif] when [group1field] has a value and when [group1field] does not. When it does you replace [group1field] with the literal value and then evaluate the rest. Remember that webcat evaluates from the inside out. Start with [group1field] and then evaluate the whole chunk by factoring in the effects of [url]...[/url]. Lastly figure out how the [showif] then decides whether or not to show its contents. Look up any of those contexts which you have not totally memorized by now. Hint::: if [group1field] does NOT have a value (and doesn't think it is a blank db field), then [url][group1field][/url]=%5Bgroup1field%5D. Study the docs on [url] until you can see why. [url][raw][group1field][/raw][/url]=%5Bgroup1field%5D. *Always*. Study the docs on [url] and [raw] until you can see why. Got it now? ;-)> > > Question 2. When I use the form search i have text on the results.tpl to this effect. > > The search for CDTitle+Type+Category found 4 items > > which was > > The search for [group1field] found [numfound] items. > > Is there a way to get the value of group1field to display?Notice this part of your form::: Descriptions and by Title:Group1Field=CDTitle+Type+Category (if your display [Group1Field], then it should be obvious that you will get CDTitle+Type+CategoryIf you want to display what the user input, then display [woGroup1data].> > > Many Thanks > > Charley Conquest > Fresh Music > > --- You wrote: > When the var value is *not* coming from a db- > > [showif [url][someVar][/url]=[url][raw][someVar][/raw][/url]] > someVar has not been given a value > [/showif] > > It would work without the [url] wrappers so long as the input never included any comparison chars, which you generally cannot be sure of. > > **** > > When the var value *is* coming from a db- > > [showif [url][someVar][/url]=] > the field someVar of this record of this db has a literal value of *nothing* > [/showif] > > It would work without the [url] wrappers so long as the field value never included any comparison chars, which you might not be sure of. > > -John > > chas wrote: > > > And.... how do you test for empty/not empty??? > > > --- end of quote --- > > ------------------------------------------------------------- > 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://search.smithmicro.com/ ------------------------------------------------------------- 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://search.smithmicro.com/ John Butler

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:

Exists? (1997) Help! WebCat2 bug (1997) authenticating a second user, the sequel (1997) Searchable mail archive problems (2003) Why isn't this working (1999) Problem upgrading from 3.0.8 to 4.0 on MS Windoze 98 / PWS (2000) remotely creating and populating a stock inventory db - almost there! (1999) NewCart+Search with one click ? (1997) list archives (2004) [isfile] ? (1997) email database file (2005) How to include weather (2000) [referrer] tag (1997) File Upload problem solved (2002) Emailer (1997) Shopping Cart Page (1997) SKU Question (1999) Separate SSL Server (1997) [WriteFile] problems (1997) PSC recommends what date format yr 2000??? (1997)