Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-19 Thread Andy Pahne

Ulrich Stärk schrieb:

...
Are you sure that those properties really are set to false upon form 
submission and that it's not your business logic behaving strangely? Try 
 to add some debug output to your formSubmit method to make sure.



You are right. I stripped down the page and template until there was 
nothing more than the two checkboxes and - it works.


Thanks for your kind help and sorry for polluting the list with Tapestry 
unrelated issues.


Andy


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



Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Andreas Andreou
no - i dont see any problems...

What happens if you update a simple property on your page?
i.e.
input jwcid=[EMAIL PROTECTED]
 displayName=literal:Hotels
 value=ognl:searchForHotelsProperty/

Also, which 4.1 version is this with?

On 2/18/08, Andy Pahne [EMAIL PROTECTED] wrote:

 Hello,

 I have a problem with what I would consider a very basic use case:

 There's a component:

  input jwcid=[EMAIL PROTECTED]
   displayName=literal:Hotels
   value=ognl:reservationQuery.searchForHotels/
label jwcid=@FieldLabel
 field=component:doHotelSearchCheckboxHotels/label


 Unfortunatly reservationQuery.searchForHotels is updated to 'false' in
 the rewind phase, no matter whether the checkbox was selected or not.

 Is there something wrong with my component definition?

 Thanks,
 Andy



 --
 Andy

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




-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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



Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Ulrich Stärk
Bind the value property of your checkbox to a page property.

E.g. in your page class:

public abstract boolean isChecked();
public abstract void setChecked(boolean checked);

and in your template:

input jwcid=[EMAIL PROTECTED]
  displayName=literal:Hotels
  value=ognl:checked/
label jwcid=@FieldLabel
  field=component:doHotelSearchCheckboxHotels/label

Uli

Am Mo, 18.02.2008, 13:03, schrieb Andy Pahne:

 Hello,

 I have a problem with what I would consider a very basic use case:

 There's a component:

  input jwcid=[EMAIL PROTECTED]
   displayName=literal:Hotels
   value=ognl:reservationQuery.searchForHotels/
label jwcid=@FieldLabel
 field=component:doHotelSearchCheckboxHotels/label


 Unfortunatly reservationQuery.searchForHotels is updated to 'false' in
 the rewind phase, no matter whether the checkbox was selected or not.

 Is there something wrong with my component definition?

 Thanks,
 Andy



 --
 Andy

 -
 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: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Andy Pahne



Also, which 4.1 version is this with?


It's 4.1.3


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



Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Andy Pahne


But iit does not work with 4.1.5, either.


Andy Pahne schrieb:



Also, which 4.1 version is this with?


It's 4.1.3


-
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: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Andy Pahne



I tried that, but the page property is updated to false, regardless of 
the checkbox selection.


Andy




Ulrich Stärk schrieb:

Bind the value property of your checkbox to a page property.

E.g. in your page class:

public abstract boolean isChecked();
public abstract void setChecked(boolean checked);

and in your template:

input jwcid=[EMAIL PROTECTED]
  displayName=literal:Hotels
  value=ognl:checked/
label jwcid=@FieldLabel
  field=component:doHotelSearchCheckboxHotels/label

Uli

Am Mo, 18.02.2008, 13:03, schrieb Andy Pahne:

Hello,

I have a problem with what I would consider a very basic use case:

There's a component:

 input jwcid=[EMAIL PROTECTED]
  displayName=literal:Hotels
  value=ognl:reservationQuery.searchForHotels/
   label jwcid=@FieldLabel
field=component:doHotelSearchCheckboxHotels/label


Unfortunatly reservationQuery.searchForHotels is updated to 'false' in
the rewind phase, no matter whether the checkbox was selected or not.

Is there something wrong with my component definition?

Thanks,
Andy



--
Andy

-
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]




--
Andy Pahne
System Architektur  Software Design

net22 GmbH
Ehrenbergweg 24
32760 Detmold

http://www.net22.de

Email [EMAIL PROTECTED]
Telefon   +49 (5231) 58 06 40
Mobil +49 (174) 171 68 70

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



Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Andreas Andreou
That's weird...
I have so many checkboxes working here...

Perhaps you're binding the same object somewhere else?

On 2/18/08, Andy Pahne [EMAIL PROTECTED] wrote:


 I tried that, but the page property is updated to false, regardless of
 the checkbox selection.

 Andy




 Ulrich Stärk schrieb:
  Bind the value property of your checkbox to a page property.
 
  E.g. in your page class:
 
  public abstract boolean isChecked();
  public abstract void setChecked(boolean checked);
 
  and in your template:
 
  input jwcid=[EMAIL PROTECTED]
displayName=literal:Hotels
value=ognl:checked/
  label jwcid=@FieldLabel
field=component:doHotelSearchCheckboxHotels/label
 
  Uli
 
  Am Mo, 18.02.2008, 13:03, schrieb Andy Pahne:
  Hello,
 
  I have a problem with what I would consider a very basic use case:
 
  There's a component:
 
   input jwcid=[EMAIL PROTECTED]
displayName=literal:Hotels
value=ognl:reservationQuery.searchForHotels/
 label jwcid=@FieldLabel
  field=component:doHotelSearchCheckboxHotels/label
 
 
  Unfortunatly reservationQuery.searchForHotels is updated to 'false' in
  the rewind phase, no matter whether the checkbox was selected or not.
 
  Is there something wrong with my component definition?
 
  Thanks,
  Andy
 
 
 
  --
  Andy
 
  -
  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]
 


 --
 Andy Pahne
 System Architektur  Software Design

 net22 GmbH
 Ehrenbergweg 24
 32760 Detmold

 http://www.net22.de

 Email [EMAIL PROTECTED]
 Telefon   +49 (5231) 58 06 40
 Mobil +49 (174) 171 68 70

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




-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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



Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Andy Pahne


Nope



Andreas Andreou schrieb:

That's weird...
I have so many checkboxes working here...

Perhaps you're binding the same object somewhere else?



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



Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Ulrich Stärk
it might be the right time now to post your complete page class and page
template before we start doing wild guesses...

Uli

Am Mo, 18.02.2008, 15:34, schrieb Andy Pahne:

 Nope



 Andreas Andreou schrieb:
 That's weird...
 I have so many checkboxes working here...

 Perhaps you're binding the same object somewhere else?


 -
 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: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Andy Pahne

Ulrich Stärk schrieb:

it might be the right time now to post your complete page class and page
template before we start doing wild guesses...



Here you are:


Search2.java:
---

public abstract class Search2
extends BaseBookingPage
implements PageBeginRenderListener {

@InitialValue(ognl:true) @Persist
public abstract boolean isSearchForHotels();
public abstract void setSearchForHotels(boolean doIt);

@InitialValue(ognl:true) @Persist
public abstract boolean isSearchForHolidayHomes();
public abstract void setSearchForHolidayHomes(boolean doIt);


@Component(
type = Form,
id = bookingForm,
bindings = {
listener=ognl:listeners.submitForm,
delegate=ognl:beans.delegate,
clientValidationEnabled=ognl:false })
public abstract IComponent getBookingForm();


/* (non-Javadoc)
 * @see 
org.apache.tapestry.event.PageBeginRenderListener#pageBeginRender(org.apache.tapestry.event.PageEvent)

 */
public void pageBeginRender(PageEvent arg0) {

assertReservationNotLocked();

initializeArrivelDate();
initializeDepartureDate();

//if (passengerModel == null) {
//passengerModel = new IntegerPropertySelectionModel(1, 8);
//}

}



private void initializeArrivelDate() {

if(getArrivalDate() == null) {
Date arrival = DateUtil.addDays(DateUtil.getTodaysMidnight(),
 getManager().getReservationStartDateOffsetDays());
setArrivalDate(arrival);
}
}

private void initializeDepartureDate() {
if(getDepartureDate() == null) {
Date departure = 
DateUtil.addDays(DateUtil.getTodaysMidnight(),

 getManager().getReservationStartDateOffsetDays() + 1);
setDepartureDate(departure);
}

}



/**
 * Listener-Methode: Formular-Übermittlung: ReservationQuery-Objekt mit
 * den Eingabedaten des Kunden befüllen.
 * p
 * Noch mache ich die Validierung hier von Hand.
 *
 */
public IPage submitForm() {

assertReservationNotLocked();

ReservationQuery query = getReservationQuery();

// An- und Abreise
query.setArrivalDate(getArrivalDate());
query.setDepartureDate(getDepartureDate());
calculateNights(query);

query.setLocationSearchTerm(getLocationSearchTerm());
query.setPassengers(getPassengerQty());

// Art der Objekte, die gesucht werden
query.setSearchForHotels(isSearchForHotels());
query.setSearchForHolidayHomes(isSearchForHolidayHomes());

// Validierung ausgelagert
IValidationDelegate delegate = getDelegate();
validate(delegate);

if(isInError()) {
return null;
}
return getNextPage().startNewSearch();

}

protected void calculateNights(ReservationQuery query) {
DateTime arrival = new DateTime(query.getArrivalDate());
   DateTime departure = new DateTime(query.getDepartureDate());
   Days days = Days.daysBetween(arrival, departure);
   int nights = days.getDays();
   query.setNights(nights);
}


/**
 * Manuelles Validieren der Eingabedaten
 */
protected void validate(IValidationDelegate delegate) {

int days = getManager().getReservationStartDateOffsetDays();

if(getArrivalDate().before(DateUtil.daysFromToday(days - 1))) {
// arrivalDate ist zu früh
delegate.record(getArrivalDatePicker(),
Buchungen m\u00fcssen mindestens  + days
+  Tage in der Zukunft liegen);
}

if(getReservationQuery().getNights() == null || 
getReservationQuery().getNights() = 0 ) {

delegate.record(getArrivalDatePicker(),
Bitte die Daten für An- und Abreise 
\u00fcberpr\u00fcfen);

}


if(isSearchForHotels() == false  isSearchForHolidayHomes() == 
false) {
setErrorMessage(Bitte w\u00e4hlen Sie aus, welche 
Unterkunftsarten  +

gesucht werden sollen);
}

}

/** Anzahl der Passagiere */
public IPropertySelectionModel passengerModel = new 
IntegerPropertySelectionModel(1, 8);


/** Datum der Ankunft */
@Persist
public abstract Date getArrivalDate();
public abstract void setArrivalDate(Date arrivalDate);

/** Datum der Abreise */
@Persist
public abstract Date getDepartureDate();
public abstract void setDepartureDate(Date departureDate);


/** Anzahl der mitreisenden Passagiere */
@Persist
public abstract Integer getPassengerQty();

/** Suchbegriff für die Suche nach einer Location */
@Persist
public abstract String getLocationSearchTerm();
public abstract void setLocationSearchTerm(String term);


Re: [4.1] Checkbox component updates value to false regardless of selection

2008-02-18 Thread Ulrich Stärk

Andy Pahne schrieb:

Ulrich Stärk schrieb:

it might be the right time now to post your complete page class and page
template before we start doing wild guesses...



Here you are:


Unless you are calling setSearchForHotels() or 
setSearchForHolidayHomes() in your parent class your code should work 
just fine. I can see nothing wrong with it.
Are you sure that those properties really are set to false upon form 
submission and that it's not your business logic behaving strangely? Try 
 to add some debug output to your formSubmit method to make sure.


Uli


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