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:

Need a link for 4.5; was: WebDNA 4.5.1 Now Available (2003) Format question (2001) Re:Problem displaying search result (1997) [addlineitems] (1997) taxrate - off by 1 cent (1997) Running _every_ page through WebCat ? (1997) Need relative path explanation (1997) Re[2]: Enhancement Request for WebCatalog-NT (1996) Multiple fields on 1 input (1997) Re:2nd WebCatalog2 Feature Request (1996) IRC Channel (2003) need some help with a loop [nested search?] (1999) Append File help needed (2000) [sendmail] sending twice... (Update) (2003) Pulldown Menu Problem (2000) problem: mail changed (1997) Email Line Breaks (2003) 2 questions (2000) NetForms for mail, sorry (1998) Logging purchases (1997)