You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Deskins <je...@gmail.com> on 2005/09/13 22:58:19 UTC
Printer Friendly Struts Form
Is there a way to display all inputs/textareas of a struts form as plain
text for a printer-friendly version of a page?
This would be similar to how the readonly attribute of a form currently
works in struts, by changing all fields to readonly. However, in this case,
I am looking for something to change all fields to display just the values
instead of the inputs and textareas. This way I can use the same jsp in
combination with css to have a printer-friendly page by passing in a print
parameter to the struts form.
Thanks,
Jeff
Re: Printer Friendly Struts Form
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Even better, use display:none; on the checkboxes and radios so everything
lines up right. Updated:
<html>
<head>
<title>Test</title>
<style>
.cssNoBorder {
border : 0 solid #ffffff;
overflow : hidden;
background-color : #ffffff;
}
</style>
</head>
<body style="background-color;#ffffff;">
<table border="0" cellpadding="4" cellspacing="4">
<tr valign="top">
<td>Button:</td>
<td><input type="button" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Text:</td>
<td><input type="text" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Select:</td>
<td><select class="cssNoBorder"><option>1</option></select></td>
</tr>
<tr valign="top">
<td>Textarea:</td>
<td><textarea class="cssNoBorder">SomeValue</textarea></td>
</tr>
<tr valign="top">
<td>Checkbox:</td>
<td><input type="checkbox" class="cssNoBorder"
style="display:none;"> SomeValue</checkbox></td>
</tr>
<tr valign="top">
<td>Radio:</td>
<td><input type="radio" class="cssNoBorder"
style="display:none;"> SomeValue</checkbox></td>
</tr>
<tr valign="top">
<td>File:</td>
<td><input type="file" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Password:</td>
<td><input type="password" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Reset:</td>
<td><input type="reset" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Submit:</td>
<td><input type="submit" class="cssNoBorder" value="SomeValue"></td>
</tr>
</table>
</body>
</html>
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, September 14, 2005 1:36 pm, Frank W. Zammetti said:
> Yeah, no good... Below is a quick test you can play with. I couldn't
> figure out how to get the selects to work like the rest. Checkboxes and
> radios too it doesn't like you can do much with, but they may be OK. Here
> you go though, pretty simple stuff...
>
> <html>
> <head>
> <title>Test</title>
> <style>
> .cssNoBorder {
> border : 0 solid #ffffff;
> overflow : hidden;
> background-color : #ffffff;
> }
> </style>
> </head>
> <body style="background-color;#ffffff;">
> <table border="0" cellpadding="4" cellspacing="4">
> <tr valign="top">
> <td>Button:</td>
> <td><input type="button" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Text:</td>
> <td><input type="text" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Select:</td>
> <td><select class="cssNoBorder"><option>1</option></select></td>
> </tr>
> <tr valign="top">
> <td>Textarea:</td>
> <td><textarea class="cssNoBorder">SomeValue</textarea></td>
> </tr>
> <tr valign="top">
> <td>Checkbox:</td>
> <td><input type="checkbox"
> class="cssNoBorder"> SomeValue</checkbox></td>
> </tr>
> <tr valign="top">
> <td>Radio:</td>
> <td><input type="radio"
> class="cssNoBorder"> SomeValue</checkbox></td>
> </tr>
> <tr valign="top">
> <td>File:</td>
> <td><input type="file" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Password:</td>
> <td><input type="password" class="cssNoBorder"
> value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Reset:</td>
> <td><input type="reset" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Submit:</td>
> <td><input type="submit" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> </table>
> </body>
> </html>
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> On Wed, September 14, 2005 12:59 pm, Michael Jouravlev said:
>> This is what I was thinking where problem was. I don't know if CSS can
>> control borders (and arrows for comboboxes) of input elements.
>>
>> On 9/14/05, Frank W. Zammetti <fz...@omnytex.com> wrote:
>>> Laurie had the right idea... you can disable the border for form
>>> fields,
>>> and that's what you would want your stylesheet to do. You may run into
>>> some fields that can't be controlled like that, I've never tried to do
>>> them all (specifically I'm thinking of selects, which seem to be a
>>> world
>>> unto themselves many times).
>>
>> ---------------------------------------------------------------------
>> 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: Printer Friendly Struts Form
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Actually, for the checkboxes and radios you can set visibility:hidden; on
them and it will actually hide the checkbox or radio itself, not the
associated text, so that's pretty good. Just gotta find a way to deal
with the selects.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, September 14, 2005 1:36 pm, Frank W. Zammetti said:
> Yeah, no good... Below is a quick test you can play with. I couldn't
> figure out how to get the selects to work like the rest. Checkboxes and
> radios too it doesn't like you can do much with, but they may be OK. Here
> you go though, pretty simple stuff...
>
> <html>
> <head>
> <title>Test</title>
> <style>
> .cssNoBorder {
> border : 0 solid #ffffff;
> overflow : hidden;
> background-color : #ffffff;
> }
> </style>
> </head>
> <body style="background-color;#ffffff;">
> <table border="0" cellpadding="4" cellspacing="4">
> <tr valign="top">
> <td>Button:</td>
> <td><input type="button" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Text:</td>
> <td><input type="text" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Select:</td>
> <td><select class="cssNoBorder"><option>1</option></select></td>
> </tr>
> <tr valign="top">
> <td>Textarea:</td>
> <td><textarea class="cssNoBorder">SomeValue</textarea></td>
> </tr>
> <tr valign="top">
> <td>Checkbox:</td>
> <td><input type="checkbox"
> class="cssNoBorder"> SomeValue</checkbox></td>
> </tr>
> <tr valign="top">
> <td>Radio:</td>
> <td><input type="radio"
> class="cssNoBorder"> SomeValue</checkbox></td>
> </tr>
> <tr valign="top">
> <td>File:</td>
> <td><input type="file" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Password:</td>
> <td><input type="password" class="cssNoBorder"
> value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Reset:</td>
> <td><input type="reset" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> <tr valign="top">
> <td>Submit:</td>
> <td><input type="submit" class="cssNoBorder" value="SomeValue"></td>
> </tr>
> </table>
> </body>
> </html>
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> On Wed, September 14, 2005 12:59 pm, Michael Jouravlev said:
>> This is what I was thinking where problem was. I don't know if CSS can
>> control borders (and arrows for comboboxes) of input elements.
>>
>> On 9/14/05, Frank W. Zammetti <fz...@omnytex.com> wrote:
>>> Laurie had the right idea... you can disable the border for form
>>> fields,
>>> and that's what you would want your stylesheet to do. You may run into
>>> some fields that can't be controlled like that, I've never tried to do
>>> them all (specifically I'm thinking of selects, which seem to be a
>>> world
>>> unto themselves many times).
>>
>> ---------------------------------------------------------------------
>> 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: Printer Friendly Struts Form
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Yeah, no good... Below is a quick test you can play with. I couldn't
figure out how to get the selects to work like the rest. Checkboxes and
radios too it doesn't like you can do much with, but they may be OK. Here
you go though, pretty simple stuff...
<html>
<head>
<title>Test</title>
<style>
.cssNoBorder {
border : 0 solid #ffffff;
overflow : hidden;
background-color : #ffffff;
}
</style>
</head>
<body style="background-color;#ffffff;">
<table border="0" cellpadding="4" cellspacing="4">
<tr valign="top">
<td>Button:</td>
<td><input type="button" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Text:</td>
<td><input type="text" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Select:</td>
<td><select class="cssNoBorder"><option>1</option></select></td>
</tr>
<tr valign="top">
<td>Textarea:</td>
<td><textarea class="cssNoBorder">SomeValue</textarea></td>
</tr>
<tr valign="top">
<td>Checkbox:</td>
<td><input type="checkbox"
class="cssNoBorder"> SomeValue</checkbox></td>
</tr>
<tr valign="top">
<td>Radio:</td>
<td><input type="radio"
class="cssNoBorder"> SomeValue</checkbox></td>
</tr>
<tr valign="top">
<td>File:</td>
<td><input type="file" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Password:</td>
<td><input type="password" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Reset:</td>
<td><input type="reset" class="cssNoBorder" value="SomeValue"></td>
</tr>
<tr valign="top">
<td>Submit:</td>
<td><input type="submit" class="cssNoBorder" value="SomeValue"></td>
</tr>
</table>
</body>
</html>
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, September 14, 2005 12:59 pm, Michael Jouravlev said:
> This is what I was thinking where problem was. I don't know if CSS can
> control borders (and arrows for comboboxes) of input elements.
>
> On 9/14/05, Frank W. Zammetti <fz...@omnytex.com> wrote:
>> Laurie had the right idea... you can disable the border for form fields,
>> and that's what you would want your stylesheet to do. You may run into
>> some fields that can't be controlled like that, I've never tried to do
>> them all (specifically I'm thinking of selects, which seem to be a world
>> unto themselves many times).
>
> ---------------------------------------------------------------------
> 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: Printer Friendly Struts Form
Posted by Michael Jouravlev <jm...@gmail.com>.
This is what I was thinking where problem was. I don't know if CSS can
control borders (and arrows for comboboxes) of input elements.
On 9/14/05, Frank W. Zammetti <fz...@omnytex.com> wrote:
> Laurie had the right idea... you can disable the border for form fields,
> and that's what you would want your stylesheet to do. You may run into
> some fields that can't be controlled like that, I've never tried to do
> them all (specifically I'm thinking of selects, which seem to be a world
> unto themselves many times).
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Printer Friendly Struts Form
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Laurie had the right idea... you can disable the border for form fields,
and that's what you would want your stylesheet to do. You may run into
some fields that can't be controlled like that, I've never tried to do
them all (specifically I'm thinking of selects, which seem to be a world
unto themselves many times).
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, September 14, 2005 11:43 am, Michael Jouravlev said:
> On 9/13/05, Laurie Harper <la...@holoweb.net> wrote:
>> Jeff Deskins wrote:
>> > Is there a way to display all inputs/textareas of a struts form as
>> plain
>> > text for a printer-friendly version of a page?
>> >
>> > This would be similar to how the readonly attribute of a form
>> currently
>> > works in struts, by changing all fields to readonly. However, in this
>> case,
>> > I am looking for something to change all fields to display just the
>> values
>> > instead of the inputs and textareas. This way I can use the same jsp
>> in
>> > combination with css to have a printer-friendly page by passing in a
>> print
>> > parameter to the struts form.
>>
>> You don't need to do anything (Struts specific or otherwise) in your JSP
>> other than provide the appropriate print stylesheet. Add the following
>> to your JSP page:
>>
>> <link rel="stylesheet" type="text/css" href="print.css"
>> media="print"/>
>>
>> (note the 'media' attribute). Then, in print.css you can make whatever
>> formatting changes you want for printed copy, including supressing input
>> lables if you want.
>>
>> This article might help shed more light:
>>
>> http://www.alistapart.com/articles/goingtoprint
>
> He does not want to suppress form elements, he wants to print existing
> input fields and textareas without borders, as labels.
>
> Michael.
>
> ---------------------------------------------------------------------
> 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: Printer Friendly Struts Form
Posted by Michael Jouravlev <jm...@gmail.com>.
On 9/13/05, Laurie Harper <la...@holoweb.net> wrote:
> Jeff Deskins wrote:
> > Is there a way to display all inputs/textareas of a struts form as plain
> > text for a printer-friendly version of a page?
> >
> > This would be similar to how the readonly attribute of a form currently
> > works in struts, by changing all fields to readonly. However, in this case,
> > I am looking for something to change all fields to display just the values
> > instead of the inputs and textareas. This way I can use the same jsp in
> > combination with css to have a printer-friendly page by passing in a print
> > parameter to the struts form.
>
> You don't need to do anything (Struts specific or otherwise) in your JSP
> other than provide the appropriate print stylesheet. Add the following
> to your JSP page:
>
> <link rel="stylesheet" type="text/css" href="print.css"
> media="print"/>
>
> (note the 'media' attribute). Then, in print.css you can make whatever
> formatting changes you want for printed copy, including supressing input
> lables if you want.
>
> This article might help shed more light:
>
> http://www.alistapart.com/articles/goingtoprint
He does not want to suppress form elements, he wants to print existing
input fields and textareas without borders, as labels.
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Printer Friendly Struts Form
Posted by Laurie Harper <la...@holoweb.net>.
Jeff Deskins wrote:
> Is there a way to display all inputs/textareas of a struts form as plain
> text for a printer-friendly version of a page?
>
> This would be similar to how the readonly attribute of a form currently
> works in struts, by changing all fields to readonly. However, in this case,
> I am looking for something to change all fields to display just the values
> instead of the inputs and textareas. This way I can use the same jsp in
> combination with css to have a printer-friendly page by passing in a print
> parameter to the struts form.
You don't need to do anything (Struts specific or otherwise) in your JSP
other than provide the appropriate print stylesheet. Add the following
to your JSP page:
<link rel="stylesheet" type="text/css" href="print.css"
media="print"/>
(note the 'media' attribute). Then, in print.css you can make whatever
formatting changes you want for printed copy, including supressing input
lables if you want.
This article might help shed more light:
http://www.alistapart.com/articles/goingtoprint
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org