|
|
 |
 |
 |
 |
Javascript / Client Side Development
|
 |
 |
 |
 |
 |
 |
 |
 |
Difficult form problem - updating a text box for search
Hi, I am trying to achieve the following: 1/ To have a standard form in an asp web page which has various check boxes and radio buttons. As a user selects a form item it updates a text box, of which the contents are submitted to a search page. I know I could just send the form element data to a search page, but in this app, the user is creating a product code and need to see the complete code before it is search on. Is there a way to add/delete text from a text box as form elements are selected / un-selected _____________ 2/ Also, what is the best way to hide / unhide form elements when others are selected ? Thanks in advance David
David wrote on 14 mei 2007 in comp.lang.javascript: > Hi, > I am trying to achieve the following: > 1/ To have a standard form in an asp web page which has various > check boxes and radio buttons. > As a user selects a form item it updates a text box, of which the > contents are submitted to a search page. I know I could just send the > form element data to a search page, but in this app, the user is > creating a product code and need to see the complete code before it is > search on. > Is there a way to add/delete text from a text box as form elements are > selected / un-selected
<input type='checkbox' onclick ='doIt(this.name,this.checked)' name='..' <input type='radio' onclick =' ... > _____________ > 2/ Also, what is the best way to hide / unhide form elements when > others are selected ?
There is no "best" way in programming. Try: document.getElementById('myElement').style.display = (hide) ?'none' :'block'; ======== Please show your code, minimalistic that is. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Evertjan. a crit : > document.getElementById('myElement').style.display = > (hide) ?'none' :'block';
I do not understand how that works. I use to do : document.getElementById('myElement').style.display = document.getElementById('myElement').style.display==''? 'none' : ''; -- Stephane Moriaux et son (moins) vieux Mac dj dpass Stephane Moriaux and his (less) old Mac already out of date
On May 14, 10:28 pm, David <davidgor@scene-double.co.uk> wrote: > Hi, > I am trying to achieve the following: > 1/ To have a standard form in an asp web page which has various > check boxes and radio buttons. > As a user selects a form item it updates a text box, of which the > contents are submitted to a search page. I know I could just send the > form element data to a search page, but in this app, the user is > creating a product code and need to see the complete code before it is > search on. > Is there a way to add/delete text from a text box as form elements are > selected / un-selected
not unless you code it yourself what have you tried. heres how I would do it: you take the value of the element and add it to the end of the text box value and put it inside an array. if they then click on a few things and then remove something they had previously added, you must take the position of the element in the array with the value just removed (which must be unique) and remove the appropriate string from the position it will be in the text box after adding together the string lengths of the values that were before that element in the array. > _____________ > 2/ Also, what is the best way to hide / unhide form elements when > others are selected ?
have two classes called hide and show these have display:none, and display:block set the classNames of elements according to what is clicked, if you need multiple things to appear dissappear either use a div surrounding them, or set a function to take an array of element names and show/ hide them. remember to check what state they are in before you act on them if you have any overlap between single and groups of elements
> Thanks in advance > David
ASM wrote: > Evertjan. a crit : >> document.getElementById('myElement').style.display = (hide) ?'none' >> :'block'; > I do not understand how that works.
You did not misunderstand anything. It does not work as is. > I use to do : > document.getElementById('myElement').style.display = > document.getElementById('myElement').style.display==''? > 'none' : '';
Same thing I do. Well, basically. I still explicitly set 'block' or 'inline' or whatever for that matter. Only to make sure it is set back to its original style. -- -Lost Remove the extra words to reply by e-mail. Don't e-mail me. I am kidding. No I am not.
ASM wrote on 15 mei 2007 in comp.lang.javascript: > Evertjan. a crit : >> document.getElementById('myElement').style.display = >> (hide) ?'none' :'block'; > I do not understand how that works. > I use to do : > document.getElementById('myElement').style.display = > document.getElementById('myElement').style.display==''? > 'none' : '';
That is a toggle, 'hide' returns any boolean result. A toggle was not asked for, Stphane. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Evertjan. a crit : > ASM wrote on 15 mei 2007 in comp.lang.javascript: >> Evertjan. a crit : >>> document.getElementById('myElement').style.display = >>> (hide) ?'none' :'block'; >> I do not understand how that works. >> I use to do : >> document.getElementById('myElement').style.display = >> document.getElementById('myElement').style.display==''? >> 'none' : ''; > That is a toggle, 'hide' returns any boolean result.
Erreur : hide is not defined told me my FF (far from to switch something) > A toggle was not asked for, Stphane.
Je ne comprends rien cette phrase. (don't understand this sentence, and inline translators not more) -- Stephane Moriaux et son (moins) vieux Mac dj dpass Stephane Moriaux and his (less) old Mac already out of date
Evertjan. a crit : > ASM wrote on 15 mei 2007 in comp.lang.javascript: >> Evertjan. a crit : >>> document.getElementById('myElement').style.display = >>> (hide) ?'none' :'block'; >> I do not understand how that works. >> I use to do : >> document.getElementById('myElement').style.display = >> document.getElementById('myElement').style.display==''? >> 'none' : ''; > That is a toggle, 'hide' returns any boolean result.
Erreur : hide is not defined told me my FF (far from to switch something) > A toggle was not asked for, Stphane.
Je ne comprends rien cette phrase. (don't understand this sentence, and inline translators not more) -- Stephane Moriaux et son (moins) vieux Mac dj dpass Stephane Moriaux and his (less) old Mac already out of date
Evertjan. a crit : > ASM wrote on 15 mei 2007 in comp.lang.javascript: >> Evertjan. a crit : >>> document.getElementById('myElement').style.display = >>> (hide) ?'none' :'block'; >> I do not understand how that works. >> I use to do : >> document.getElementById('myElement').style.display = >> document.getElementById('myElement').style.display==''? >> 'none' : ''; > That is a toggle, 'hide' returns any boolean result.
Erreur : hide is not defined told me my FF (far from to switch something) > A toggle was not asked for, Stphane.
Je ne comprends rien cette phrase. (don't understand this sentence, and inline translators not more) -- Stephane Moriaux et son (moins) vieux Mac dj dpass Stephane Moriaux and his (less) old Mac already out of date
ASM wrote on 15 mei 2007 in comp.lang.javascript:
> Evertjan. a crit : >> ASM wrote on 15 mei 2007 in comp.lang.javascript: >>> Evertjan. a crit : >>>> document.getElementById('myElement').style.display = >>>> (hide) ?'none' :'block'; >>> I do not understand how that works. >>> I use to do : >>> document.getElementById('myElement').style.display = >>> document.getElementById('myElement').style.display==''? >>> 'none' : ''; >> That is a toggle, 'hide' returns any boolean result. > Erreur : hide is not defined > told me my FF > (far from to switch something)
Why should it be defined, It is not a complete code. >> A toggle was not asked for, Stphane. > Je ne comprends rien cette phrase. > (don't understand this sentence, and inline translators not more)
Tant pis pour vous. Voi: <http://www.wordreference.com/enfr/toggle> > and inline translators not more)
Je ne comprends pas cette phrase. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Evertjan. a crit :
> ASM wrote on 15 mei 2007 in comp.lang.javascript: >> Evertjan. a crit : >>> ASM wrote on 15 mei 2007 in comp.lang.javascript: >>>> Evertjan. a crit : >>>>> document.getElementById('myElement').style.display = >>>>> (hide) ?'none' :'block'; >>>> I do not understand how that works. >>> That is a toggle, 'hide' returns any boolean result. >> Erreur : hide is not defined >> told me my FF >> (far from to switch something) > Why should it be defined, It is not a complete code.
Ha? alors ... si ce n'est pas du code ... >>> A toggle was not asked for, Stphane. >> Je ne comprends rien cette phrase. >> (don't understand this sentence, and inline translators not more) > Tant pis pour vous. > Voi: <http://www.wordreference.com/enfr/toggle>
I understand what is toggle, but not the sens of the sentence. (my poor english ...) >> and inline translators not more) > Je ne comprends pas cette phrase.
and web translators not more (understand sense of ...) non plus que les traducteurs en ligne pas plus que les traducteurs en ligne example : http://www.lexilogos.com/traduction_multilingue.htm -- Stephane Moriaux et son (moins) vieux Mac dj dpass Stephane Moriaux and his (less) old Mac already out of date
|
 |
 |
 |
 |
|