Re: REPOST: The old multiple selection bit

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 29912
interpreted = N
texte = on 4/3/2000 11:30 AM, Andrew Vernon at avernon@dramatools.net wrote:> > On 3/31/00 3:16 PM, Kenneth Grome at ken@simplewebstores.com wrote: > >>> I need to use multiple-selection lists for both queries and data entry. >>> >>> If I'm using [formvariables] to match up the form fields with their >>> corresponding db fields, how would I ensure I could make sure each part of a >>> multiple selection list was stored or queried? >> >> You'll have to disassemble the specific formvariable for this field into its >> components, then reassemble it so the components get used properly in your >> search and append contexts. > > Pardon my ignorance, guys, but how would I do that? An illustrative sample > would help immensely. > > I'm so damn green at this I need watering and fertilizing. :-)When the browser sends form data with a multiple select, you basically get a list of items with name=value pairs like so: multipleMenu=selection A multipleMenu=selection D multipleMenu=selection RIf you were to get the value of the select with a standard, singular variable value like [multipleMenu], you would only get *one* of the selections. So to get all the values selected in a multiple select, you have to use the [formvariables] context and specify which form field to disassemble. Here's a basic code sample for you. This will append a comma delimited list of the selections in a multiple select to a field in a database. ========= The select =========== ================================ ========= The Append =========== [append db=your.db] SIZES=[formvariables name=M_SIZES&exact=T][url][value][/url],[/formvariables][/append] ================================If you want to take this one step further, you can build your forms with a simple naming convention that will allow you to automate search, replace, and appends with the help of the [formvariables] context. Here's an example of an append using this method: If you were to use a naming convention in all your forms where you name all your text input fields with a prefix of T_ followed by the name of the database field that they will be appended to, and name all your multiple select inputs with a M_ prefix followed by the name of the database field that a comma delimited list of selected items will be appended to, then this one [append] context will work for all your forms: ============ Append ============ [append db=[DB]][formvariables name=F_&exact=F][hideif [index]=1]&[/hideif][getchars start=3][name][/getchars]=[url][value][/url][/formvariables][formvariables name=M_&exact=F][showif [xxyyzz]![name]]&[getchars start=3][name][/getchars]=[/showif][url][value][/url],[text]xxyyzz =[name][/text][/formvariables][/append] ================================Does that qualify as an illustrative example? Hope it helps.Mike ------------------------------------------------------------- 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 Associated Messages, from the most recent to the oldest:

    
  1. Re: REPOST: The old multiple selection bit (Mike Davis 2000)
  2. REPOST: The old multiple selection bit (Andrew Vernon 2000)
on 4/3/2000 11:30 AM, Andrew Vernon at avernon@dramatools.net wrote:> > On 3/31/00 3:16 PM, Kenneth Grome at ken@simplewebstores.com wrote: > >>> I need to use multiple-selection lists for both queries and data entry. >>> >>> If I'm using [formvariables] to match up the form fields with their >>> corresponding db fields, how would I ensure I could make sure each part of a >>> multiple selection list was stored or queried? >> >> You'll have to disassemble the specific formvariable for this field into its >> components, then reassemble it so the components get used properly in your >> search and append contexts. > > Pardon my ignorance, guys, but how would I do that? An illustrative sample > would help immensely. > > I'm so damn green at this I need watering and fertilizing. :-)When the browser sends form data with a multiple select, you basically get a list of items with name=value pairs like so: multipleMenu=selection A multipleMenu=selection D multipleMenu=selection RIf you were to get the value of the select with a standard, singular variable value like [multipleMenu], you would only get *one* of the selections. So to get all the values selected in a multiple select, you have to use the [formvariables] context and specify which form field to disassemble. Here's a basic code sample for you. This will append a comma delimited list of the selections in a multiple select to a field in a database. ========= The select =========== ================================ ========= The Append =========== [append db=your.db] SIZES=[formvariables name=M_SIZES&exact=T][url][value][/url],[/formvariables][/append] ================================If you want to take this one step further, you can build your forms with a simple naming convention that will allow you to automate search, replace, and appends with the help of the [formvariables] context. Here's an example of an append using this method: If you were to use a naming convention in all your forms where you name all your text input fields with a prefix of T_ followed by the name of the database field that they will be appended to, and name all your multiple select inputs with a M_ prefix followed by the name of the database field that a comma delimited list of selected items will be appended to, then this one [append] context will work for all your forms: ============ Append ============ [append db=[DB]][formvariables name=F_&exact=F][hideif [index]=1]&[/hideif][getchars start=3][name][/getchars]=[url][value][/url][/formvariables][formvariables name=M_&exact=F][showif [xxyyzz]![name]]&[getchars start=3][name][/getchars]=[/showif][url][value][/url],[text]xxyyzz =[name][/text][/formvariables][/append] ================================Does that qualify as an illustrative example? Hope it helps.Mike ------------------------------------------------------------- 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 Mike Davis

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:

Error:Too many nested [xxx] contexts (1997) Follow-Up: Problem upgrading from 3.0.8 to 4.0 on MSWindoze 98 / PWS (2000) RAM crash (1998) Counter for SKUs viewed (2002) Time to opensource? was [SMSI] WebDNA is too good to go (2006) Webcat and other cgi (2000) Error: Permision deny. Unable to append to (2002) Re:Change WebDNA-Talk Mail due to no digest for 1wk (1997) how to put/keep product customization info in basket? (1998) This list needs a digest: rant, rave... (1997) WebCatalog for Postcards ? (1997) Queertrons? (1997) Not really WebCat (1997) 4.5 Upgrade (2003) Version 4 (2000) [WebDNA] max number of searches and lookups on a page (2016) Striping Characters (1998) Help formatting search results w/ table (1997) Botched cart numbers in webmerchant 2.1x email with webcat 3 (1998) Trouble with Netscape (1998)