Connecting Tech Pros Worldwide Help | Site Map

Difficult form problem - updating a text box for search

David
Guest
 
Posts: n/a
#1: May 14 '07
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

Evertjan.
Guest
 
Posts: n/a
#2: May 14 '07

re: Difficult form problem - updating a text box for search


David wrote on 14 mei 2007 in comp.lang.javascript:
Quote:
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 =' ...
Quote:
_____________
>
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)
ASM
Guest
 
Posts: n/a
#3: May 15 '07

re: Difficult form problem - updating a text box for search


Evertjan. a écrit :
Quote:
>
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 déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
shimmyshack
Guest
 
Posts: n/a
#4: May 15 '07

re: Difficult form problem - updating a text box for search


On May 14, 10:28 pm, David <davidgor...@scene-double.co.ukwrote:
Quote:
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.

Quote:
>
_____________
>
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

Quote:
>
Thanks in advance
>
David

-Lost
Guest
 
Posts: n/a
#5: May 15 '07

re: Difficult form problem - updating a text box for search


ASM wrote:
Quote:
Evertjan. a écrit :
Quote:
>>
>document.getElementById('myElement').style.displa y = (hide) ?'none'
>:'block';
>
I do not understand how that works.
You did not misunderstand anything. It does not work as is.
Quote:
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.
Evertjan.
Guest
 
Posts: n/a
#6: May 15 '07

re: Difficult form problem - updating a text box for search


ASM wrote on 15 mei 2007 in comp.lang.javascript:
Quote:
Evertjan. a écrit :
Quote:
>>
>document.getElementById('myElement').style.displa y =
>(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, Stéphane.



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
ASM
Guest
 
Posts: n/a
#7: May 15 '07

re: Difficult form problem - updating a text box for search


Evertjan. a écrit :
Quote:
ASM wrote on 15 mei 2007 in comp.lang.javascript:
>
Quote:
>Evertjan. a écrit :
Quote:
>>document.getElementById('myElement').style.displ ay =
>>(hide) ?'none' :'block';
>I do not understand how that works.
>>
>I use to do :
>>
>document.getElementById('myElement').style.displa y =
>document.getElementById('myElement').style.displa y==''?
> 'none' : '';
>
That is a toggle, 'hide' returns any boolean result.
Erreur : hide is not defined
told me my FF
(far from to switch something)
Quote:
A toggle was not asked for, Stéphane.
Je ne comprends rien à cette phrase.
(don't understand this sentence, and inline translators not more)


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
ASM
Guest
 
Posts: n/a
#8: May 15 '07

re: Difficult form problem - updating a text box for search


Evertjan. a écrit :
Quote:
ASM wrote on 15 mei 2007 in comp.lang.javascript:
>
Quote:
>Evertjan. a écrit :
Quote:
>>document.getElementById('myElement').style.displ ay =
>>(hide) ?'none' :'block';
>I do not understand how that works.
>>
>I use to do :
>>
>document.getElementById('myElement').style.displa y =
>document.getElementById('myElement').style.displa y==''?
> 'none' : '';
>
That is a toggle, 'hide' returns any boolean result.
Erreur : hide is not defined
told me my FF
(far from to switch something)
Quote:
A toggle was not asked for, Stéphane.
Je ne comprends rien à cette phrase.
(don't understand this sentence, and inline translators not more)


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
ASM
Guest
 
Posts: n/a
#9: May 15 '07

re: Difficult form problem - updating a text box for search


Evertjan. a écrit :
Quote:
ASM wrote on 15 mei 2007 in comp.lang.javascript:
>
Quote:
>Evertjan. a écrit :
Quote:
>>document.getElementById('myElement').style.displ ay =
>>(hide) ?'none' :'block';
>I do not understand how that works.
>>
>I use to do :
>>
>document.getElementById('myElement').style.displa y =
>document.getElementById('myElement').style.displa y==''?
> 'none' : '';
>
That is a toggle, 'hide' returns any boolean result.
Erreur : hide is not defined
told me my FF
(far from to switch something)
Quote:
A toggle was not asked for, Stéphane.
Je ne comprends rien à cette phrase.
(don't understand this sentence, and inline translators not more)


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Evertjan.
Guest
 
Posts: n/a
#10: May 16 '07

re: Difficult form problem - updating a text box for search


ASM wrote on 15 mei 2007 in comp.lang.javascript:
Quote:
Evertjan. a écrit :
Quote:
>ASM wrote on 15 mei 2007 in comp.lang.javascript:
>>
Quote:
>>Evertjan. a écrit :
>>>document.getElementById('myElement').style.disp lay =
>>>(hide) ?'none' :'block';
>>I do not understand how that works.
>>>
>>I use to do :
>>>
>>document.getElementById('myElement').style.displ ay =
>>document.getElementById('myElement').style.displ ay==''?
>> '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.

Quote:
>
Quote:
>A toggle was not asked for, Stéphane.
>
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>
Quote:
and inline translators not more)
Je ne comprends pas cette phrase.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
ASM
Guest
 
Posts: n/a
#11: May 16 '07

re: Difficult form problem - updating a text box for search


Evertjan. a écrit :
Quote:
ASM wrote on 15 mei 2007 in comp.lang.javascript:
>
Quote:
>Evertjan. a écrit :
Quote:
>>ASM wrote on 15 mei 2007 in comp.lang.javascript:
>>>
>>>Evertjan. a écrit :
>>>>document.getElementById('myElement').style.dis play =
>>>>(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 ...
Quote:
Quote:
Quote:
>>A toggle was not asked for, Stéphane.
>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 ...)
Quote:
Quote:
>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 déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Evertjan.
Guest
 
Posts: n/a
#12: May 16 '07

re: Difficult form problem - updating a text box for search


ASM wrote on 16 mei 2007 in comp.lang.javascript:
Quote:
Evertjan. a écrit :
Quote:
>ASM wrote on 15 mei 2007 in comp.lang.javascript:
>>
Quote:
>>Evertjan. a écrit :
>>>ASM wrote on 15 mei 2007 in comp.lang.javascript:
>>>>
>>>>Evertjan. a écrit :
>>>>>document.getElementById('myElement').style.di splay =
>>>>>(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 ...
>
Quote:
Quote:
>>>A toggle was not asked for, Stéphane.
>>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 ...)
Peut-être:

Le poseur original n'a pas posé sa Q sur une function basculante.

"... 'hide' returns any boolean result"

.... 'hide' est une variable et retourne une valeur booléene.

Quote:
Quote:
Quote:
>>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
C'est bon ça, le idiom done une "joie de vivre" aux lanques
heureusement incompréhensible aux traducteurs en ligne.

That completes my capacity of composing written French,
bad or worse, today (UTC).

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
ASM
Guest
 
Posts: n/a
#13: May 16 '07

re: Difficult form problem - updating a text box for search


Evertjan. a écrit :
Quote:
ASM wrote on 16 mei 2007 in comp.lang.javascript:
>
Quote:
>Evertjan. a écrit :
>>
Quote:
>>>>A toggle was not asked for, Stéphane.
>
Peut-être:
>
Le poseur original n'a pas posé sa Q sur une function basculante.
Ho? possibly, and then ?

Have we to answer exactly ? Can't we show other solution(s) ?

The OP asked :
Quote:
2/ Also, what is the best way to hide / unhide form elements when
Quote:
others are selected ?
a toggle could do the stuff,
a toggle was I thought you gave as code
(it was only suggested and answer's built was out of my understanding )
Quote:
C'est bon ça, le idiom done une "joie de vivre" aux lanques
heureusement incompréhensible aux traducteurs en ligne.
They can gives some atrocities !
Curiously, a wrong result remade in good language and re-submited
can give back what was submited in first ...



--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Closed Thread