RE: Obtaining check box data from a form

2006-09-07 Thread Mark Stang
The example in the Component Reference doesn't provide the simplest example...


Name: Mark J. Stang
Title: Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-Original Message-
From: Peter Dawn [mailto:[EMAIL PROTECTED]
Sent: Thu 9/7/2006 4:38 PM
To: Tapestry users
Subject: Re: Obtaining check box data from a form
 
Mark, so as per your example, if i am understanding it corrently, i
can only retrieve the boolean value and not the corresponding string
associated with the checkbox.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Obtaining check box data from a form

2006-09-07 Thread Mark Stang
Pretty much.  There may be a way, but it is coded in the HTML.  However, I 
don't think you need to do so.  Or rather I don't think you should need the 
values that were displayed, they should be hard-coded text in an HTML form.  
Why do you need the text that is in the HTML?

Name: Mark J. Stang
Title: Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-Original Message-
From: Peter Dawn [mailto:[EMAIL PROTECTED]
Sent: Thu 9/7/2006 4:38 PM
To: Tapestry users
Subject: Re: Obtaining check box data from a form
 
Mark, so as per your example, if i am understanding it corrently, i
can only retrieve the boolean value and not the corresponding string
associated with the checkbox.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Obtaining check box data from a form

2006-09-07 Thread Peter Dawn

Mark, so as per your example, if i am understanding it corrently, i
can only retrieve the boolean value and not the corresponding string
associated with the checkbox.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Obtaining check box data from a form

2006-09-07 Thread Mark Stang
Peter,
Checkboxes are like any other field.

HTML:



Allowable SAML Bindings








Artifact
   




POST






Redirect






SOAP



 
   



JWC:












 


 







 




JAVA:
private boolean artifactBinding = true;
private boolean postBinding = true;
private boolean redirectBinding = true;
private boolean soapBinding = true;

public boolean isArtifactBinding()
{
return artifactBinding;
}

public void setArtifactBinding(boolean artifactBinding)
{
this.artifactBinding = artifactBinding;
}

public boolean isPostBinding()
{
return postBinding;
}

public void setPostBinding(boolean postBinding)
{
this.postBinding = postBinding;
}

public boolean isRedirectBinding()
{
return redirectBinding;
}

public void setRedirectBinding(boolean redirectBinding)
{
this.redirectBinding = redirectBinding;
}

public boolean isSoapBinding()
{
return soapBinding;
}

public void setSoapBinding(boolean soapBinding)
{
this.soapBinding = soapBinding;
}

All you have to do is put 1-n in an HTML template.  I have mine declared in the 
.jwc, but you could just put it in the HTML.  Then link them to some method in 
a java class somewhere. I have mine updating a visit object value 
"currentState".  "Current State" is the users "current state".  Pick a java 
object somewhere.

The values of the boolean values will be displayed as checked or unchecked just 
as the data is in the java object.  If the user checks or unchecks a checkbox 
and submits it then the java method is called.  The end result is that the java 
boolean values are displayed and modifiable by your users.  When submitted they 
automatically populate your java values.  No different than a Text Input Field.

hth,

Mark

Name: Mark J. Stang
Title: Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-Original Message-
From: Peter Dawn [mailto:[EMAIL PROTECTED]
Sent: Wed 9/6/2006 11:56 PM
To: Tapestry users
Subject: Re: Obtaining check box data from a form
 
ok. the only other way for me to obtain a users selection would a
radio button. might try that.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Re: Obtaining check box data from a form

2006-09-07 Thread Sam Gendler

The Tapestry Checkbox component doesn't offer a way to do what you
want but it is possible to do it.  If you have multiple input fields
with the same name, the servlet spec says that you can call
request.getParameters("fieldName") and receive an array of strings.

So here's how I solved this:

Write some code that renders a plain  rather than using Tapestry Checkbox
component.  If you want to make it a component, one very similar to
existing Checkbox, then so much the better.

Now make another component called CheckboxGroup.  Include a listener
method which will get executed whenever the CheckboxGroup is rewound.
Your custom Checkbox component can check if the current Container is a
CheckboxGroup.  if it is, get the name from the CheckboxGroup.  Then,
in your Group listener, call getWebRequest().getParameters("myName")
to retrieve a String[] of values. Now, if necessary, convert the
string to an actual object.  Then assign the array to the appropriate
place. html would look something like this:


 
 


Although in our case, we skipped the CustomCheckbox component
entirely.  We just pass a SelectionModel to the CheckboxGroup, and use
the label and value properties to render a checkbox from the render
method of the CheckboxGroup.  We can fetch the values during the
rewind method of the same component.  And some simple ognl
manipulations on the name parameter can allow you to assign the
resulting values to the named object/property.

Of course, I have no idea if any of this will work in Tap3, but in my
case, it was only a couple of hours in Tap4, mostly spent figuring out
what changes I needed to make to the contrib:MultiplePropertySelection
and contrib:CheckBoxMultiplePropertySelectionRenderer.  The code was
easy enough to understand and modify to my own needs.

--sam


On 9/6/06, Peter Dawn <[EMAIL PROTECTED]> wrote:

ok. the only other way for me to obtain a users selection would a
radio button. might try that.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Peter Dawn

ok. the only other way for me to obtain a users selection would a
radio button. might try that.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Jesse Kuhnert

Most of the time a checkbox - by definition - is more of a boolean operation
than value...But far be it from me to argue with semantics that do work..

If you want to just get past the problem and move on you can always call
IRequestCycle.getParameterValues("thenameyou gaveallofyourcheckboxes");

On 9/7/06, Peter Dawn <[EMAIL PROTECTED]> wrote:


just to clarify again, i want to gather the underlying value of each
checkbox and not its label.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com


Re: Obtaining check box data from a form

2006-09-06 Thread Peter Dawn

just to clarify again, i want to gather the underlying value of each
checkbox and not its label.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Peter Dawn

ok i will try again.

i have a bunch of options which the user can select from. they are all
checkboxes (approx say 25). based on this user selection i display
corresponding information on the next page.

now first thing,
1. how should i group these checkboxes, individually, within a span or
something else (multiplepropertyselection)
2. once the user selects their options and presses submit, i want to
gather the data from all selected checkboxes.

i hope this is better.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Nick Westgate

Hi Peter.

Your explanation is rather vague, but if you want to treat the checkboxes
as a group, you might want to look at the contrib MultiplePropertySelection:
http://tapestry.apache.org/tapestry3/doc/api/org/apache/tapestry/contrib/form/MultiplePropertySelection.html

Note that all the html docs are included in the Tapestry download.

Cheers,
Nick.


Peter Dawn wrote:

may be i should put everything within a span and then pass on values
of checked checkboxes. but how do i group them together. if they were
radio buttons i would have selected RadioGroup.

any help guys.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Peter Dawn

may be i should put everything within a span and then pass on values
of checked checkboxes. but how do i group them together. if they were
radio buttons i would have selected RadioGroup.

any help guys.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Peter Dawn

i can pass a boolean fine. but how do i pass on the value of the
checkbox on a submit.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Peter Dawn

its good for a start. how come i couldnt find it. but thanks anyways.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Obtaining check box data from a form

2006-09-06 Thread Jesse Kuhnert

Does this help?

http://tapestry.apache.org/tapestry3/doc/ComponentReference/Checkbox.html

On 9/7/06, Peter Dawn <[EMAIL PROTECTED]> wrote:


guys,

i am trying to implement a big form within my web app. in the form the
user is able to select through checkboxes what information they want
viewed. now each checkbox has a corresponding value associated with
it.

now when the user clicks on the submit button, i want to pass on the
values of all checked checkboxes to my java code (the value of
unchecked boxes should not be passed).

I have been working on it all morning now. can somebody help me out
with this. i am using tap3.

thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com