Re: Dependent drop down list

2007-04-25 Thread tapuser

Hi Simeon,
 Could you please provide some sample? I would like to
implement dependent drop down list ( partial page rendering)?

Thanks.
Sri.


Simeon Koptelov-2 wrote:
> 
> Well, I've done this for my project, using tacos:AjaxDirectLink to update 
> dependent select. If you're interested, I can package it and deploy to 
> tassel.
> 
> -- 
> Best, Simeon Koptelov
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Dependent-drop-down-list-tf1563364.html#a10189827
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: dependent drop down list, ognl.InappropriateExpressionException

2006-05-11 Thread Geoff Longman

Robert,

The Option component expects that the selected parameter is bound to
an expression that it can read *and* write to. In other words it
expects the expression to evaluate to a bean property.

You expression works on a render (read) as it evals to a boolean and
that's ok, a value would be what a getter method would return.

However, on a rewind (write), Option is trying to set the property
that the expression evaluates to - and that doesn't work with the
expresson you have.

Hence the exception.

Geoff

public class InappropriateExpressionException
extends OgnlException

Exception thrown if an OGNL expression is evaluated in the wrong
context; the usual case is when an expression that does not end in a
property reference is passed to setValue.

http://www.opensymphony.com/ognl/api/ognl/InappropriateExpressionException.html

On 5/10/06, Robert Hannebauer <[EMAIL PROTECTED]> wrote:

Hi,

i tried to implement two dependent select boxes.
This is my very simple test case.

Home.html:



   
  
 

 
  

  
 

 
  




Home.java:

package test.page;

import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;

import org.apache.commons.collections.iterators.ArrayIterator;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.engine.IPageLoader;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.spec.IComponentSpecification;

public abstract class Test extends BasePage {

public final static int DAYS[] = new int[31];

static {
for (int i = 1; i <= 31; ++i) {
DAYS[i-1] = i;
}
}

public abstract String getMonth();
public abstract void setMonth(String s);
public abstract int getMonthIndex();
public abstract void setMonthIndex(int l);

public abstract int getDay();
public abstract void setDay(int i);
public abstract int getDayIndex();
public abstract void setDayIndex(int l);

public abstract Calendar getDate();
public abstract void setDate(Calendar date);

public Iterator getMonthValues() {
String months[] = new 
DateFormatSymbols(getPage().getLocale()).getMonths();
if (months[months.length - 1].length() > 1) {
return new ArrayIterator(months);
}
return new ArrayIterator(months, 0, months.length-1);
}

public Iterator getDayValues() {
return new ArrayIterator(DAYS, 0, 
getDate().getActualMaximum(Calendar.DAY_OF_MONTH));
}

@Override
public void finishLoad(IRequestCycle arg0, IPageLoader arg1, 
IComponentSpecification arg2) {
super.finishLoad(arg0, arg1, arg2);

Calendar c = Calendar.getInstance(getPage().getLocale());
c.setTime(new Date());
setDate(c);
   }
}

The first time the page renders without errors. The correct values are 
preselected.
But when i select a new month i get an exception:

org.apache.hivemind.ApplicationRuntimeException
Unable to update OGNL expression '' of [EMAIL 
PROTECTED] to false: Inappropriate OGNL expression:
date.get(@[EMAIL PROTECTED]) == day

ognl.InappropriateExpressionException
Inappropriate OGNL expression: date.get(@[EMAIL PROTECTED]) == day


What's going wrong? I'm running out of ideas.

Robert

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





--
The Spindle guy. http://spindle.sf.net
Blog:  http://jroller.com/page/glongman
Other interests:  http://www.squidoo.com/spaceelevator/

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



dependent drop down list, ognl.InappropriateExpressionException

2006-05-10 Thread Robert Hannebauer
Hi,

i tried to implement two dependent select boxes.
This is my very simple test case.

Home.html:



   
  
   

 
  

  



 
   




Home.java:

package test.page;

import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;

import org.apache.commons.collections.iterators.ArrayIterator;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.engine.IPageLoader;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.spec.IComponentSpecification;

public abstract class Test extends BasePage {

public final static int DAYS[] = new int[31];

static {
for (int i = 1; i <= 31; ++i) {
DAYS[i-1] = i;
}
}

public abstract String getMonth();
public abstract void setMonth(String s);
public abstract int getMonthIndex();
public abstract void setMonthIndex(int l);

public abstract int getDay();
public abstract void setDay(int i);
public abstract int getDayIndex();
public abstract void setDayIndex(int l);

public abstract Calendar getDate();
public abstract void setDate(Calendar date);

public Iterator getMonthValues() {
String months[] = new 
DateFormatSymbols(getPage().getLocale()).getMonths();
if (months[months.length - 1].length() > 1) {
return new ArrayIterator(months);
}
return new ArrayIterator(months, 0, months.length-1);
}

public Iterator getDayValues() {
return new ArrayIterator(DAYS, 0, 
getDate().getActualMaximum(Calendar.DAY_OF_MONTH));
}

@Override
public void finishLoad(IRequestCycle arg0, IPageLoader arg1, 
IComponentSpecification arg2) {
super.finishLoad(arg0, arg1, arg2);

Calendar c = Calendar.getInstance(getPage().getLocale());
c.setTime(new Date());
setDate(c);
   }
}

The first time the page renders without errors. The correct values are 
preselected.
But when i select a new month i get an exception:

org.apache.hivemind.ApplicationRuntimeException
Unable to update OGNL expression '' of [EMAIL 
PROTECTED] to false: Inappropriate OGNL expression:
date.get(@[EMAIL PROTECTED]) == day

ognl.InappropriateExpressionException
Inappropriate OGNL expression: date.get(@[EMAIL PROTECTED]) == day


What's going wrong? I'm running out of ideas.

Robert

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



Re: Dependent drop down list

2006-05-08 Thread Stephane Decleire

I've implemented Sam's solution in my project (thanks Sam !).
When the page is refreshed with the new items in the drop down list, i 
would like that this form element keep the focus but the focus is reset 
to the first element in the form ...

Any advice is welcome.

Stephane

Sam Gendler wrote:


I do this frequently, but I reload the entire page so that it doesn't
get out of sync with rewind.

Declare your form like this:

   
   
   
   
   

Then, within the html element that will become the drop down, include
the following:

onchange="javascript:this.form.events.refresh();"

This will cause the form to call your refresh listener (which bypasses
validation), so you can change values before the form is rendered back
to the client.  Then a submit button will call the submit listener,
which will perform validation and let you treat the form as though it
was submitted.

--sam


On 5/5/06, Stephane Decleire <[EMAIL PROTECTED]> wrote:


But what about the errors that would come up during the rewind of the
form data ?

Greg Cormier wrote:

>I'd add a button next to your zipcode text field (maybe a "refresh" 
button), and that would invoke a listener to set your dropdown based 
on the area code.

>
>Greg
>
>-Original Message-
>From: Stephane Decleire [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 05, 2006 7:37 AM
>To: tapestry-user@jakarta.apache.org
>Subject: Dependent drop down list
>
>
>Hi,
>
>I would like to reload a form to modify the content of a drop down list
>of cities depending on the zipcode set by the user in this form.
>As anybody seen a sample of code to implement such a behavior ?
>
>Thanks in advance.
>
>
>

--
Stéphane Decleire

05 56 57 99 20
06 63 78 69 06





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



--
Stéphane Decleire

05 56 57 99 20
06 63 78 69 06



Re: Dependent drop down list

2006-05-07 Thread Pedro Viegas

Hi Simeon,

That would be very helpfull thanks.
If you could do that please let me know how to get to it. Sorry but I
haven't heard of tassel.

Regards,


On 5/7/06, Simeon Koptelov <[EMAIL PROTECTED]> wrote:


Well, I've done this for my project, using tacos:AjaxDirectLink to update
dependent select. If you're interested, I can package it and deploy to
tassel.

--
Best, Simeon Koptelov


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





--
Pedro Viegas


Re: Dependent drop down list

2006-05-07 Thread Simeon Koptelov
Well, I've done this for my project, using tacos:AjaxDirectLink to update 
dependent select. If you're interested, I can package it and deploy to 
tassel.

-- 
Best, Simeon Koptelov


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