You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hubert Hers <in...@huberthers.com> on 2007/07/08 12:49:02 UTC

How suppress the HTML INPUT from Struts2 Combobox?

Hi,

According to the Struts2 (2.0.8) documentation a combo box is an HTML INPUT
of type text and HTML SELECT grouped together to give you a combo box
functionality.
Does anyone know if it is possible to suppress the HTML INPUT?
And if so, how?

Or if not, any advice how to implement in Struts2 a 'normal' combobox
without a text field?

Many thanks in advance.

Hubert



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How suppress the HTML INPUT from Struts2 Combobox?

Posted by Richard Sayre <ri...@gmail.com>.
The <s:select/> is the tag your looking for.

Check the Doc here. http://struts.apache.org/2.x/docs/select.html


On 7/8/07, Hubert Hers <in...@huberthers.com> wrote:
> Hi,
>
> According to the Struts2 (2.0.8) documentation a combo box is an HTML INPUT
> of type text and HTML SELECT grouped together to give you a combo box
> functionality.
> Does anyone know if it is possible to suppress the HTML INPUT?
> And if so, how?
>
> Or if not, any advice how to implement in Struts2 a 'normal' combobox
> without a text field?
>
> Many thanks in advance.
>
> Hubert
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AW: How suppress the HTML INPUT from Struts2 Combobox?

Posted by Dave Newton <ne...@yahoo.com>.
--- Hubert Hers <in...@huberthers.com> wrote:
> By a 'normal' combobox I mean a combobox like in
> javax.swing.JComboBox or as the HTML select.

I'm still not getting you, I think. What functionality
do you want that <s:select.../> doesn't provide?

d.

> -----Ursprüngliche Nachricht-----
> Von: Dave Newton [mailto:newton.dave@yahoo.com] 
> Gesendet: Sonntag, 8. Juli 2007 17:27
> An: Struts Users Mailing List
> Betreff: Re: How suppress the HTML INPUT from
> Struts2 Combobox?
> 
> --- Hubert Hers <in...@huberthers.com> wrote:
> > According to the Struts2 (2.0.8) documentation a
> > combo box is an HTML INPUT of type text and HTML 
> > SELECT grouped together to give you a combo box
> > functionality. Does anyone know if it is possible
> to
> 
> > suppress the HTML INPUT? And if so, how?
> > 
> > Or if not, any advice how to implement in Struts2
> a
> > 'normal' combobox without a text field?
> 
> I thought a "normal" combobox *was* a text field
> with
> a select. If you don't want the text field isn't it
> just a select box?
> 
> d.
> 
> 
>        
>
____________________________________________________________________________
> ________
> Sick sense of humor? Visit Yahoo! TV's 
> Comedy with an Edge to see what's on, when. 
> http://tv.yahoo.com/collections/222
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



       
____________________________________________________________________________________Ready for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV. 
http://tv.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


AW: How suppress the HTML INPUT from Struts2 Combobox?

Posted by Hubert Hers <in...@huberthers.com>.
Hi Adrian,

Yeah, that's like I am looking for. Thanks a lot!

Hubert

-----Ursprüngliche Nachricht-----
Von: Rios, Adrian [mailto:Adrian_Rios@adp.com] 
Gesendet: Sonntag, 8. Juli 2007 19:42
An: Struts Users Mailing List
Betreff: RE: How suppress the HTML INPUT from Struts2 Combobox?

Hubert, 

Not sure if this is what you are looking for but you can try this.

In the combobox, you can do something simple like the disabled option.

<select class="name" name="name" style="" tabindex="" disabled="disabled">
	<option value="" >--Select--</option>
		<c:forEach items="${}" var="currentitem" varStatus="count">
			<option>
				stuff goes in here.....
			</option>
		</c:forEach>
</select>

In the text field, you could do something simple like....maybe the readonly
option....or you could use a function where capture the keystrokes of the
user.   

I included some JavaScript functions.  The function whichButtonN captures
all key strokes by users....now you could change the function to capture all
key strokes.  The function cleanNum is a safety net....just in case the user
copies values into the text field.

<input type="text" value="" name="" class="maintextInput"
onchange='cleanNum(this)' onkeypress="return(whichButtonN(event))"
maxlength="" readonly=readonly />


function whichButtonN(event)
{
	//if (event.keyCode == 32) return false;
	if (event.keyCode > 47 && event.keyCode < 58) return true;
	else return false;
	
}

function cleanNum (w){

	var inptString = w.value;
	var valid="1234567890" ;
    var output='';
   		for (var i=0; i<inptString.length; i++){
      		if (valid.indexOf(inptString.charAt(i)) != -1){
         		output += inptString.charAt(i)
      		}
    	}
    	w.value=output;
   return output;
}

I hope this helps....

Adrian
__________________________________________________

Senior Programmer Analyst, Tax Distributed Systems Development

Tax & Compliance Development, ADP IT

Phone: (909) 592-6411 Ext. 3863

e-mail: adrian_rios@adp.com



-----Original Message-----
From: Hubert Hers [mailto:info@huberthers.com] 
Sent: Sunday, July 08, 2007 9:30 AM
To: 'Struts Users Mailing List'
Subject: AW: How suppress the HTML INPUT from Struts2 Combobox?


By a 'normal' combobox I mean a combobox like in javax.swing.JComboBox or as
the HTML select.

Hubert

-----Ursprüngliche Nachricht-----
Von: Dave Newton [mailto:newton.dave@yahoo.com] 
Gesendet: Sonntag, 8. Juli 2007 17:27
An: Struts Users Mailing List
Betreff: Re: How suppress the HTML INPUT from Struts2 Combobox?

--- Hubert Hers <in...@huberthers.com> wrote:
> According to the Struts2 (2.0.8) documentation a
> combo box is an HTML INPUT of type text and HTML 
> SELECT grouped together to give you a combo box
> functionality. Does anyone know if it is possible to

> suppress the HTML INPUT? And if so, how?
> 
> Or if not, any advice how to implement in Struts2 a
> 'normal' combobox without a text field?

I thought a "normal" combobox *was* a text field with
a select. If you don't want the text field isn't it
just a select box?

d.


       
____________________________________________________________________________
________
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


-----------------------------------------
This message and any attachments are intended only for the use of
the addressee and may contain information that is privileged and
confidential. If the reader of the message is not the intended
recipient or an authorized representative of the intended
recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in error, notify the sender immediately by return
email and delete the message and any attachments from your system.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: How suppress the HTML INPUT from Struts2 Combobox?

Posted by "Rios, Adrian" <Ad...@adp.com>.
Hubert, 

Not sure if this is what you are looking for but you can try this.

In the combobox, you can do something simple like the disabled option.

<select class="name" name="name" style="" tabindex="" disabled="disabled">
	<option value="" >--Select--</option>
		<c:forEach items="${}" var="currentitem" varStatus="count">
			<option>
				stuff goes in here.....
			</option>
		</c:forEach>
</select>

In the text field, you could do something simple like....maybe the readonly option....or you could use a function where capture the keystrokes of the user.   

I included some JavaScript functions.  The function whichButtonN captures all key strokes by users....now you could change the function to capture all key strokes.  The function cleanNum is a safety net....just in case the user copies values into the text field.

<input type="text" value="" name="" class="maintextInput" onchange='cleanNum(this)' onkeypress="return(whichButtonN(event))" maxlength="" readonly=readonly />


function whichButtonN(event)
{
	//if (event.keyCode == 32) return false;
	if (event.keyCode > 47 && event.keyCode < 58) return true;
	else return false;
	
}

function cleanNum (w){

	var inptString = w.value;
	var valid="1234567890" ;
    var output='';
   		for (var i=0; i<inptString.length; i++){
      		if (valid.indexOf(inptString.charAt(i)) != -1){
         		output += inptString.charAt(i)
      		}
    	}
    	w.value=output;
   return output;
}

I hope this helps....

Adrian
__________________________________________________

Senior Programmer Analyst, Tax Distributed Systems Development

Tax & Compliance Development, ADP IT

Phone: (909) 592-6411 Ext. 3863

e-mail: adrian_rios@adp.com



-----Original Message-----
From: Hubert Hers [mailto:info@huberthers.com] 
Sent: Sunday, July 08, 2007 9:30 AM
To: 'Struts Users Mailing List'
Subject: AW: How suppress the HTML INPUT from Struts2 Combobox?


By a 'normal' combobox I mean a combobox like in javax.swing.JComboBox or as
the HTML select.

Hubert

-----Ursprüngliche Nachricht-----
Von: Dave Newton [mailto:newton.dave@yahoo.com] 
Gesendet: Sonntag, 8. Juli 2007 17:27
An: Struts Users Mailing List
Betreff: Re: How suppress the HTML INPUT from Struts2 Combobox?

--- Hubert Hers <in...@huberthers.com> wrote:
> According to the Struts2 (2.0.8) documentation a
> combo box is an HTML INPUT of type text and HTML 
> SELECT grouped together to give you a combo box
> functionality. Does anyone know if it is possible to

> suppress the HTML INPUT? And if so, how?
> 
> Or if not, any advice how to implement in Struts2 a
> 'normal' combobox without a text field?

I thought a "normal" combobox *was* a text field with
a select. If you don't want the text field isn't it
just a select box?

d.


       
____________________________________________________________________________
________
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


-----------------------------------------
This message and any attachments are intended only for the use of
the addressee and may contain information that is privileged and
confidential. If the reader of the message is not the intended
recipient or an authorized representative of the intended
recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in error, notify the sender immediately by return
email and delete the message and any attachments from your system.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


AW: How suppress the HTML INPUT from Struts2 Combobox?

Posted by Hubert Hers <in...@huberthers.com>.
By a 'normal' combobox I mean a combobox like in javax.swing.JComboBox or as
the HTML select.

Hubert

-----Ursprüngliche Nachricht-----
Von: Dave Newton [mailto:newton.dave@yahoo.com] 
Gesendet: Sonntag, 8. Juli 2007 17:27
An: Struts Users Mailing List
Betreff: Re: How suppress the HTML INPUT from Struts2 Combobox?

--- Hubert Hers <in...@huberthers.com> wrote:
> According to the Struts2 (2.0.8) documentation a
> combo box is an HTML INPUT of type text and HTML 
> SELECT grouped together to give you a combo box
> functionality. Does anyone know if it is possible to

> suppress the HTML INPUT? And if so, how?
> 
> Or if not, any advice how to implement in Struts2 a
> 'normal' combobox without a text field?

I thought a "normal" combobox *was* a text field with
a select. If you don't want the text field isn't it
just a select box?

d.


       
____________________________________________________________________________
________
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How suppress the HTML INPUT from Struts2 Combobox?

Posted by Dave Newton <ne...@yahoo.com>.
--- Hubert Hers <in...@huberthers.com> wrote:
> According to the Struts2 (2.0.8) documentation a
> combo box is an HTML INPUT of type text and HTML 
> SELECT grouped together to give you a combo box
> functionality. Does anyone know if it is possible to

> suppress the HTML INPUT? And if so, how?
> 
> Or if not, any advice how to implement in Struts2 a
> 'normal' combobox without a text field?

I thought a "normal" combobox *was* a text field with
a select. If you don't want the text field isn't it
just a select box?

d.


       
____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org