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:

Search Engine questions ... (2002) searching by date range help needed (1997) Re:quit command on NT (1997) Removing a character (2000) Thanks Grant (1997) Re:Change WebDNA-Talk Mail due to no digest for 1wk (1997) Moment of Thanks (1997) Quit revisited (1997) Newbie search question (between two dates) (2001) New command suggestion (was Modifying databases manually) (1997) Error Messages Returned to User (1997) Frames and WebCat (1997) validatin on NT (sorry for the dups and etc) (1998) WC Database Format (1997) more ! testing (1997) Question on the sandbox (2003) Emailer again (1997) attachment (2000) wc 2 pro users - sites, quotes wanted (1997) Calculating Age from DB fields (2003)