Re: Updating checkboxes made easy !!!

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 18187
interpreted = N
texte = It's an interesting trick, but I sure wouldn't trust it in any sort of critical application. You are relying on how the browser interprets multiple input fields with the same name, and since this is an HTML no-no (except for groups of radio buttons and groups of checkboxes) you can't be at all confident that any two browsers (or servers for that matter) are going to handle it in the same way. A better way to accomplish the self-updating page is:---update.html----[ShowIf [action]=update] [Replace db=sample.db&eqSKUdatarq=1]Choice1=[HideIf [Choice1]=[Raw][Choice1][/Raw]][Choice1][/HideIf]&Choice2=[HideIf [Choice2]=[Raw][Choice1][/Raw]][Choice2][/HideIf][/Replace] [/ShowIf][Search db=samples.db&eqSKUdatarq=1] [FoundItems]
Choice 1:

Choice 2:

[/FoundItems] [/Search]------------------If you access the page from a normal hypertext link, it will just display your form with whatever data is in the db. When you re-load the page by submiting the form, the hidden variable action triggers the [ShowIf] at the top of the page, your data gets [Replace]d and the form is updated with the new data.-Dave At 3:55 PM 6/11/98, Laurent Pladys wrote: >I have just discovered a way of updating checkbox fields in a database >with only one page ... > >Let say you have the following database : >( choice1 and choice2 are checkboxes in your input form) >------sample.db----- >sku choice1 choice2 >1 on >-------------------- > >If you want to update the content of the checkboxes, usually you have a >first page containing > >Choice 1 : [choice1]=on]checked[/showif]> >

>Choice 2: [choice2]=on]checked[/showif]> > >and in the following page you have to check for the value entered to >update the database with something like that in a replace context > >[showif [choice1]=on]&choice1=on[/showif][showif >[choice1]!on]&choice1=[/showif][showif >>[choice2]=on]&choice2=on[/showif][showif [choice2]!on]&choice2=[/showif] > >Which is not really developper friendly, especially if you want to update >a lot of checkboxes .... > >Now you can update the checkbow from WITHIN the form : > >Choice 1 : [choice1]=on]checked[/showif]> > >

>Choice 2: [choice2]=on]checked[/showif]> > > >Try it for yoursel with the sample database sample.db and the following >page wich auto display itself after you update it (you can edit sample.db >after changing the checkbox to see that it has been updated) > >----- update.tmpl ----- > > > >update checkbox > > >

Update me !

>[search db=update.db&eqskudata=1] >[founditems] >
> > > > > >Choice 1 : [choice1]=on]checked[/showif]> > >

>Choice 2: [choice2]=on]checked[/showif]> > >

> >

>[/founditems] > > >---------- > >Sorry if everybody already knew that but I found this trick very useful. > >Enjoy, > >laurent > >--- >Laurent Pladys >LXir > > L a u r e n t P l a d y s >--------------------------------------------- > L X i r >_____________________________________________ > 1 5 5 r u e d e P i c p u s > 7 5 0 1 2 P a r i s > F r a n c e >_____________________________________________ > +33 (0)1 44 68 80 60 (tel) > +33 (0)1 44 68 80 61 (fax) >_____________________________________________ > w w w . L X i r . n e t > l t p l a d y s @ L X i r . n e t o--------------- Dave MacLeay --+ o----------- Digital Frontier --+ o--- dave@digitalfrontier.com --+ Associated Messages, from the most recent to the oldest:

    
  1. Re: Updating checkboxes made easy !!! (Laurent Pladys 1998)
  2. Re: Updating checkboxes made easy !!! (Dave MacLeay 1998)
  3. Re: Updating checkboxes made easy !!! (Laurent Pladys 1998)
  4. Re: Updating checkboxes made easy !!! (Laurent Pladys 1998)
  5. Updating checkboxes made easy !!! (Laurent Pladys 1998)
  6. Re: Updating checkboxes made easy !!! (Dave MacLeay 1998)
  7. Re: Updating checkboxes made easy !!! (Bob Minor 1998)
It's an interesting trick, but I sure wouldn't trust it in any sort of critical application. You are relying on how the browser interprets multiple input fields with the same name, and since this is an HTML no-no (except for groups of radio buttons and groups of checkboxes) you can't be at all confident that any two browsers (or servers for that matter) are going to handle it in the same way. A better way to accomplish the self-updating page is:---update.html----[ShowIf [action]=update] [Replace db=sample.db&eqSKUdatarq=1]Choice1=[HideIf [Choice1]=[raw][Choice1][/Raw]][Choice1][/HideIf]&Choice2=[HideIf [Choice2]=[raw][Choice1][/Raw]][Choice2][/HideIf][/Replace] [/ShowIf][Search db=samples.db&eqSKUdatarq=1] [founditems]
[thisurl] method=post> Choice 1:

Choice 2:

[/FoundItems] [/Search]------------------If you access the page from a normal hypertext link, it will just display your form with whatever data is in the db. When you re-load the page by submiting the form, the hidden variable action triggers the [showif] at the top of the page, your data gets [replace]d and the form is updated with the new data.-Dave At 3:55 PM 6/11/98, Laurent Pladys wrote: >I have just discovered a way of updating checkbox fields in a database >with only one page ... > >Let say you have the following database : >( choice1 and choice2 are checkboxes in your input form) >------sample.db----- >sku choice1 choice2 >1 on >-------------------- > >If you want to update the content of the checkboxes, usually you have a >first page containing > >Choice 1 : [choice1]=on]checked[/showif]> >

>Choice 2: [choice2]=on]checked[/showif]> > >and in the following page you have to check for the value entered to >update the database with something like that in a replace context > >[showif [choice1]=on]&choice1=on[/showif][showif >[choice1]!on]&choice1=[/showif][showif >>[choice2]=on]&choice2=on[/showif][showif [choice2]!on]&choice2=[/showif] > >Which is not really developper friendly, especially if you want to update >a lot of checkboxes .... > >Now you can update the checkbow from WITHIN the form : > >Choice 1 : [choice1]=on]checked[/showif]> > >

>Choice 2: [choice2]=on]checked[/showif]> > > >Try it for yoursel with the sample database sample.db and the following >page wich auto display itself after you update it (you can edit sample.db >after changing the checkbox to see that it has been updated) > >----- update.tmpl ----- > > > >update checkbox > > >

Update me !

>[search db=update.db&eqskudata=1] >[founditems] >
> > > > > >Choice 1 : [choice1]=on]checked[/showif]> > >

>Choice 2: [choice2]=on]checked[/showif]> > >

> >

>[/founditems] > > >---------- > >Sorry if everybody already knew that but I found this trick very useful. > >Enjoy, > >laurent > >--- >Laurent Pladys >LXir > > L a u r e n t P l a d y s >--------------------------------------------- > L X i r >_____________________________________________ > 1 5 5 r u e d e P i c p u s > 7 5 0 1 2 P a r i s > F r a n c e >_____________________________________________ > +33 (0)1 44 68 80 60 (tel) > +33 (0)1 44 68 80 61 (fax) >_____________________________________________ > w w w . L X i r . n e t > l t p l a d y s @ L X i r . n e t o--------------- Dave MacLeay --+ o----------- Digital Frontier --+ 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:

verify online (1997) Possible Bug in 2.0b15.acgi (1997) No luck with taxes (1997) Merging databases (1997) Modifying order output (1997) Please post more "exceptions to the rules" ... (2005) Formatting a .txt file (1998) database files in secure folder (1997) Re:listfiles-looking for slick solution (1997) can WC render sites out? (1997) off-topic - printinglib 68K (1997) Date sorting (1997) Solve the Problem, get the code! (2001) restart needed???? (1997) Help with Repost Data msg from form (1997) Emailer Chokes on bad address (1997) [WebDNA] Search question (2013) unique ascending numbers (2003) WebTen and WebCat (1997) Re:Problem (1997)