Re: Radio group add ajax behavior

2015-04-20 Thread Chris
Ok, I have fixed it by setting the id for the list items and adapting the 
callback function to select by id and then by name.

Chris


 Am 20.04.2015 um 21:53 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 I have put the radio group in a list of items. Basically it works so when I 
 click on a radio button the corresponding item is called.
 However, when clicking the cancel button, always the radio group of the first 
 item in the list is called. How can the callback function 
 ($('input[name=\%s\]')[0];) be bound to the items so not the first input 
 field in the DOM tree is called?
 The id of the items is given by Wicket...
 
 Thanks Chris
 
 
 
 Am 20.04.2015 um 03:35 schrieb Chris chris...@gmx.at:
 
 Perfect - thanks a lot for the hint!
 
 best regards, Chris
 
 Am 19.04.2015 um 22:43 schrieb Sven Meier s...@meiers.net:
 
 Hi Christ,
 
 for AjaxFormChoiceComponentUpdatingBehavior it is important that the click 
 happens on one of the radio elements.
 If the selection is cancalled, we can just use the first radio:
 
  String name = formComponent.getInputName();
 
 response.render(OnDomReadyHeaderItem.forScript(String.format($('input[name=\%s\]').rating({
  callback: function(value, link) { var option = this; if (value == 
 undefined) { option = $('input[name=\%s\]')[0]; } 
 $(option).trigger('click'); }});, name, name)));
 
 Note that I had to remove a 'workaround' from the plugin's soure to make 
 this work (line 181 ff):
 
  // backward compatibility, form element to plugin
 //input.on('change.rating',function(event){
 //if(event.selfTriggered) return false;
 //$(this).rating('select');
 //});
 
 I don't understand what that is for - but that isn't a Wicket question ;).
 
 Regards
 Sven
 
 
 On 19.04.2015 20:46, Chris wrote:
 Hi Sven  all,
 
 I would also like to get a callback for the cancel button.
 
 I tried following adjustment, but in this case the 
 #onUpdate(AjaxRequestTarget target) method is called multiple times and in 
 the end, all stars are colored/enabled (instead of all stars greyed out).
 
 response.render(OnDomReadyHeaderItem.forScript(String.format($('%s').rating({
  callback: function(value, link) {  if (typeof $(this).attr('id') == 
 'undefined') {$('%s').trigger('click');} else {$(this).trigger('click');} 
 }});, selector, selector)));
 
 When the cancel rating link is clicked the id is undefined. I cannot make 
 a JS click event on this div, maybe as it is added later via the JS?
 http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
  
 http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
 
 thanks a lot,
 Chris
 
 
 
 
 Am 19.04.2015 um 15:26 schrieb Chris chris...@gmx.at:
 
 Sven, you are great!
 
 Your solution works perfect.
 
 Thanks a lot for your help!!
 Chris
 
 Am 19.04.2015 um 11:55 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 I've opened a pull request.
 
 Hope this helps
 Sven
 
 
 On 19.04.2015 02:43, Chris wrote:
 Hi Sven  all,
 
 when using the JS Star Rating plugin 
 (https://www.fyneworks.com/jquery/star-rating 
 https://www.fyneworks.com/jquery/star-rating, star images instead of 
 radio boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not 
 work anymore.
 
 I have created a sample project based on the wicket-example 
 „RadioGroupPage“ and put it here: https://github.com/cat1000/StarRating 
 https://github.com/cat1000/StarRating
 
 It would be great if someone could have a look the conflict.
 
 Thanks a lot,
 Chris
 
 
 
 
 
 Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 have you added the AjaxFormChoicecomponentUpdatingBehaviour in this 
 example to the group?
 
 group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
 protected void onUpdate(AjaxRequestTarget target) {
 // Ajax actions here
 System.out.println(The selected value is  + 
 getComponent().getDefaultModelObjectAsString());
 }
 });
 
 Thanks, Chris
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
 form wicket:id=form class=form
div class=rating wicket:id=group
   input wicket:id=radio1 type=radio/
input wicket:id=radio2 type=radio/
   ...
/div
 /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio 

Re: Radio group add ajax behavior

2015-04-20 Thread Chris
Hi Sven,

I have put the radio group in a list of items. Basically it works so when I 
click on a radio button the corresponding item is called.
However, when clicking the cancel button, always the radio group of the first 
item in the list is called. How can the callback function 
($('input[name=\%s\]')[0];) be bound to the items so not the first input 
field in the DOM tree is called?
The id of the items is given by Wicket...

Thanks Chris



 Am 20.04.2015 um 03:35 schrieb Chris chris...@gmx.at:
 
 Perfect - thanks a lot for the hint!
 
 best regards, Chris
 
 Am 19.04.2015 um 22:43 schrieb Sven Meier s...@meiers.net:
 
 Hi Christ,
 
 for AjaxFormChoiceComponentUpdatingBehavior it is important that the click 
 happens on one of the radio elements.
 If the selection is cancalled, we can just use the first radio:
 
   String name = formComponent.getInputName();
 
 response.render(OnDomReadyHeaderItem.forScript(String.format($('input[name=\%s\]').rating({
  callback: function(value, link) { var option = this; if (value == 
 undefined) { option = $('input[name=\%s\]')[0]; } 
 $(option).trigger('click'); }});, name, name)));
 
 Note that I had to remove a 'workaround' from the plugin's soure to make 
 this work (line 181 ff):
 
   // backward compatibility, form element to plugin
 //input.on('change.rating',function(event){
 //if(event.selfTriggered) return false;
 //$(this).rating('select');
 //});
 
 I don't understand what that is for - but that isn't a Wicket question ;).
 
 Regards
 Sven
 
 
 On 19.04.2015 20:46, Chris wrote:
 Hi Sven  all,
 
 I would also like to get a callback for the cancel button.
 
 I tried following adjustment, but in this case the 
 #onUpdate(AjaxRequestTarget target) method is called multiple times and in 
 the end, all stars are colored/enabled (instead of all stars greyed out).
 
 response.render(OnDomReadyHeaderItem.forScript(String.format($('%s').rating({
  callback: function(value, link) {  if (typeof $(this).attr('id') == 
 'undefined') {$('%s').trigger('click');} else {$(this).trigger('click');} 
 }});, selector, selector)));
 
 When the cancel rating link is clicked the id is undefined. I cannot make a 
 JS click event on this div, maybe as it is added later via the JS?
 http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
  
 http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
 
 thanks a lot,
 Chris
 
 
 
 
 Am 19.04.2015 um 15:26 schrieb Chris chris...@gmx.at:
 
 Sven, you are great!
 
 Your solution works perfect.
 
 Thanks a lot for your help!!
 Chris
 
 Am 19.04.2015 um 11:55 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 I've opened a pull request.
 
 Hope this helps
 Sven
 
 
 On 19.04.2015 02:43, Chris wrote:
 Hi Sven  all,
 
 when using the JS Star Rating plugin 
 (https://www.fyneworks.com/jquery/star-rating 
 https://www.fyneworks.com/jquery/star-rating, star images instead of 
 radio boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not 
 work anymore.
 
 I have created a sample project based on the wicket-example 
 „RadioGroupPage“ and put it here: https://github.com/cat1000/StarRating 
 https://github.com/cat1000/StarRating
 
 It would be great if someone could have a look the conflict.
 
 Thanks a lot,
 Chris
 
 
 
 
 
 Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 have you added the AjaxFormChoicecomponentUpdatingBehaviour in this 
 example to the group?
 
 group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
  protected void onUpdate(AjaxRequestTarget target) {
  // Ajax actions here
  System.out.println(The selected value is  + 
 getComponent().getDefaultModelObjectAsString());
  }
 });
 
 Thanks, Chris
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
  form wicket:id=form class=form
 div class=rating wicket:id=group
input wicket:id=radio1 type=radio/
 input wicket:id=radio2 type=radio/
...
 /div
  /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like 
 to add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the 
 #onUpdate is never called currently.
 
 How to fix this?
 
 
 
 Form form 

Re: Radio group add ajax behavior

2015-04-19 Thread Sven Meier

Hi Chris,

I've opened a pull request.

Hope this helps
Sven


On 19.04.2015 02:43, Chris wrote:

Hi Sven  all,

when using the JS Star Rating plugin (https://www.fyneworks.com/jquery/star-rating 
https://www.fyneworks.com/jquery/star-rating, star images instead of radio 
boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not work anymore.

I have created a sample project based on the wicket-example „RadioGroupPage“ and put 
it here: https://github.com/cat1000/StarRating 
https://github.com/cat1000/StarRating

It would be great if someone could have a look the conflict.

Thanks a lot,
Chris






Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:

Hi Sven,

have you added the AjaxFormChoicecomponentUpdatingBehaviour in this example to 
the group?

group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
System.out.println(The selected value is  + 
getComponent().getDefaultModelObjectAsString());
}
});

Thanks, Chris


Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:

Looks good.

I've just added an AjaxFormChoiceComponentUpdatingBehavior to wicket-examples' 
RadioGroupPage and it worked as expected.

Which Wicket version? Can you create a quickstart?

Have fun
Sven

On 18.04.2015 13:19, Chris wrote:

The html is as follows:

wicket:panel
form wicket:id=form class=form
   div class=rating wicket:id=group
  input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
  ...
   /div
/form
/wicket:panel

best regards, Chris



Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:

Hi Sven,

the form is added to a panel.

Chris



Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:

Hi,

is your RadioGroup is bound to wicket:container in your markup?

Sven

On 18.04.2015 07:00, Chris wrote:

Hi all,

I have a radio group with different radio choices and I would like to add ajax 
behavior to the group.
With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate is 
never called currently.

How to fix this?



Form form = new Form(form);
RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, new 
ModelRadioChoice() {...}

RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
ModelRadioChoice(1));
RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
ModelRadioChoice(2));
radioGroup.add(radio1);
radioGroupd.add(Radio2);

form.add(radioGroup);

radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   protected void onUpdate(AjaxRequestTarget target) {
   // Ajax actions here
   }
});

Thanks, Chris
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-19 Thread Chris
Sven, you are great!

Your solution works perfect.

Thanks a lot for your help!!
Chris

 Am 19.04.2015 um 11:55 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 I've opened a pull request.
 
 Hope this helps
 Sven
 
 
 On 19.04.2015 02:43, Chris wrote:
 Hi Sven  all,
 
 when using the JS Star Rating plugin 
 (https://www.fyneworks.com/jquery/star-rating 
 https://www.fyneworks.com/jquery/star-rating, star images instead of radio 
 boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not work anymore.
 
 I have created a sample project based on the wicket-example „RadioGroupPage“ 
 and put it here: https://github.com/cat1000/StarRating 
 https://github.com/cat1000/StarRating
 
 It would be great if someone could have a look the conflict.
 
 Thanks a lot,
 Chris
 
 
 
 
 
 Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 have you added the AjaxFormChoicecomponentUpdatingBehaviour in this example 
 to the group?
 
 group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
System.out.println(The selected value is  + 
 getComponent().getDefaultModelObjectAsString());
}
 });
 
 Thanks, Chris
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
form wicket:id=form class=form
   div class=rating wicket:id=group
  input wicket:id=radio1 type=radio/
 input wicket:id=radio2 type=radio/
  ...
   /div
/form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to 
 add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the 
 #onUpdate is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new 
 RadioGroupRadioChoice(group, new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   protected void onUpdate(AjaxRequestTarget target) {
   // Ajax actions here
   }
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-19 Thread Chris
Hi Sven  all,

I would also like to get a callback for the cancel button. 

I tried following adjustment, but in this case the #onUpdate(AjaxRequestTarget 
target) method is called multiple times and in the end, all stars are 
colored/enabled (instead of all stars greyed out).

response.render(OnDomReadyHeaderItem.forScript(String.format($('%s').rating({ 
callback: function(value, link) {  if (typeof $(this).attr('id') == 
'undefined') {$('%s').trigger('click');} else {$(this).trigger('click');} 
}});, selector, selector)));

When the cancel rating link is clicked the id is undefined. I cannot make a JS 
click event on this div, maybe as it is added later via the JS?
http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
 
http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button

thanks a lot,
Chris




 Am 19.04.2015 um 15:26 schrieb Chris chris...@gmx.at:
 
 Sven, you are great!
 
 Your solution works perfect.
 
 Thanks a lot for your help!!
 Chris
 
 Am 19.04.2015 um 11:55 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 I've opened a pull request.
 
 Hope this helps
 Sven
 
 
 On 19.04.2015 02:43, Chris wrote:
 Hi Sven  all,
 
 when using the JS Star Rating plugin 
 (https://www.fyneworks.com/jquery/star-rating 
 https://www.fyneworks.com/jquery/star-rating, star images instead of 
 radio boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not work 
 anymore.
 
 I have created a sample project based on the wicket-example 
 „RadioGroupPage“ and put it here: https://github.com/cat1000/StarRating 
 https://github.com/cat1000/StarRating
 
 It would be great if someone could have a look the conflict.
 
 Thanks a lot,
 Chris
 
 
 
 
 
 Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 have you added the AjaxFormChoicecomponentUpdatingBehaviour in this 
 example to the group?
 
 group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   protected void onUpdate(AjaxRequestTarget target) {
   // Ajax actions here
   System.out.println(The selected value is  + 
 getComponent().getDefaultModelObjectAsString());
   }
 });
 
 Thanks, Chris
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
   form wicket:id=form class=form
  div class=rating wicket:id=group
 input wicket:id=radio1 type=radio/
input wicket:id=radio2 type=radio/
 ...
  /div
   /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to 
 add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the 
 #onUpdate is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new 
 RadioGroupRadioChoice(group, new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
  protected void onUpdate(AjaxRequestTarget target) {
  // Ajax actions here
  }
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: 

Re: Radio group add ajax behavior

2015-04-19 Thread Chris
Perfect - thanks a lot for the hint!

best regards, Chris

 Am 19.04.2015 um 22:43 schrieb Sven Meier s...@meiers.net:
 
 Hi Christ,
 
 for AjaxFormChoiceComponentUpdatingBehavior it is important that the click 
 happens on one of the radio elements.
 If the selection is cancalled, we can just use the first radio:
 
String name = formComponent.getInputName();
 
 response.render(OnDomReadyHeaderItem.forScript(String.format($('input[name=\%s\]').rating({
  callback: function(value, link) { var option = this; if (value == undefined) 
 { option = $('input[name=\%s\]')[0]; } $(option).trigger('click'); }});, 
 name, name)));
 
 Note that I had to remove a 'workaround' from the plugin's soure to make this 
 work (line 181 ff):
 
// backward compatibility, form element to plugin
 //input.on('change.rating',function(event){
 //if(event.selfTriggered) return false;
 //$(this).rating('select');
 //});
 
 I don't understand what that is for - but that isn't a Wicket question ;).
 
 Regards
 Sven
 
 
 On 19.04.2015 20:46, Chris wrote:
 Hi Sven  all,
 
 I would also like to get a callback for the cancel button.
 
 I tried following adjustment, but in this case the 
 #onUpdate(AjaxRequestTarget target) method is called multiple times and in 
 the end, all stars are colored/enabled (instead of all stars greyed out).
 
 response.render(OnDomReadyHeaderItem.forScript(String.format($('%s').rating({
  callback: function(value, link) {  if (typeof $(this).attr('id') == 
 'undefined') {$('%s').trigger('click');} else {$(this).trigger('click');} 
 }});, selector, selector)));
 
 When the cancel rating link is clicked the id is undefined. I cannot make a 
 JS click event on this div, maybe as it is added later via the JS?
 http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
  
 http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
 
 thanks a lot,
 Chris
 
 
 
 
 Am 19.04.2015 um 15:26 schrieb Chris chris...@gmx.at:
 
 Sven, you are great!
 
 Your solution works perfect.
 
 Thanks a lot for your help!!
 Chris
 
 Am 19.04.2015 um 11:55 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 I've opened a pull request.
 
 Hope this helps
 Sven
 
 
 On 19.04.2015 02:43, Chris wrote:
 Hi Sven  all,
 
 when using the JS Star Rating plugin 
 (https://www.fyneworks.com/jquery/star-rating 
 https://www.fyneworks.com/jquery/star-rating, star images instead of 
 radio boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not work 
 anymore.
 
 I have created a sample project based on the wicket-example 
 „RadioGroupPage“ and put it here: https://github.com/cat1000/StarRating 
 https://github.com/cat1000/StarRating
 
 It would be great if someone could have a look the conflict.
 
 Thanks a lot,
 Chris
 
 
 
 
 
 Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 have you added the AjaxFormChoicecomponentUpdatingBehaviour in this 
 example to the group?
 
 group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   protected void onUpdate(AjaxRequestTarget target) {
   // Ajax actions here
   System.out.println(The selected value is  + 
 getComponent().getDefaultModelObjectAsString());
   }
 });
 
 Thanks, Chris
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
   form wicket:id=form class=form
  div class=rating wicket:id=group
 input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
 ...
  /div
   /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like 
 to add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the 
 #onUpdate is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new 
 RadioGroupRadioChoice(group, new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
  protected void onUpdate(AjaxRequestTarget target) {
 

Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

I tried following function but that still does only work with JQuery Rating JS 
disabled.
With JQuery Rating, the function is not called.

   $('input[name=field1_type]').change(function() {
trigger('click');
   });


Below is the HTML code when Rating JS is enabled:

div class=rating id=field1__type1482
span class=star-rating-controldiv 
class=rating-cancela title=Cancel Rating/a/div
div role=text aria-label= 
class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
star-rating-live star-rating-on id=tt1__field11489a 
title=radio16radio16/a/divdiv role=text aria-label= 
class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
star-rating-live star-rating-on id=tt1__field2148aa 
title=radio17radio17/a/divdiv role=text aria-label= 
class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
star-rating-live star-rating-on id=tt1__field3148ba 
title=radio18radio18/a/divdiv role=text aria-label= 
class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
star-rating-live star-rating-on id=tt1__field4148ca 
title=radio19radio19/a/divdiv role=text aria-label= 
class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
star-rating-live id=tt1__field5148da 
title=radio20radio20/a/div/spaninput name=field1_type type=radio 
class=star wicket-field1__type1482 star-rating-applied id=tt1__field11489 
value=radio16 style=display: none;
input name=field1_type type=radio class=star 
wicket-field1__type1482 star-rating-applied id=tt1__field2148a 
value=radio17 style=display: none;
input name=field1_type type=radio class=star 
wicket-field1__type1482 star-rating-applied id=tt1__field3148b 
value=radio18 style=display: none;
input name=field1_type type=radio class=star 
wicket-field1__type1482 star-rating-applied id=tt1__field4148c 
value=radio19 style=display: none;
input name=field1_type type=radio class=star 
wicket-field1__type1482 star-rating-applied id=tt1__field5148d 
value=radio20 style=display: none;
/div


br Chris


 Am 18.04.2015 um 13:46 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 does the JS trigger click() on the radio when the user selects a rating? When 
 not, check for a callback to trigger click() by yourself.
 
 Regards
 Sven
 
 
 On 18.04.2015 13:34, Chris wrote:
 Hi Sven,
 
 thanks a lot for your help!
 I am using the jquery star rating JS to replace the radio boxes through 
 stars - with that it does not work. Without it I just tried it and AJAX 
 works (thanks for your feedback!)
 Why might there be a problem with the jQuery JS?
 
 br, Chris
 
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
  wicket:panel
 form wicket:id=form class=form
div class=rating wicket:id=group
   input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
   ...
/div
 /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to 
 add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate 
 is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new 
 RadioGroupRadioChoice(group, new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
}
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 -
 To unsubscribe, e-mail: 

Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

thanks a lot for your help!
I am using the jquery star rating JS to replace the radio boxes through stars - 
with that it does not work. Without it I just tried it and AJAX works (thanks 
for your feedback!)
Why might there be a problem with the jQuery JS?

br, Chris


 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
  wicket:panel
 form wicket:id=form class=form
div class=rating wicket:id=group
   input wicket:id=radio1 type=radio/
input wicket:id=radio2 type=radio/
   ...
/div
 /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to add 
 ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate 
 is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, 
 new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
}
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-18 Thread Sven Meier

Hi Chris,

does the JS trigger click() on the radio when the user selects a rating? 
When not, check for a callback to trigger click() by yourself.


Regards
Sven


On 18.04.2015 13:34, Chris wrote:

Hi Sven,

thanks a lot for your help!
I am using the jquery star rating JS to replace the radio boxes through stars - 
with that it does not work. Without it I just tried it and AJAX works (thanks 
for your feedback!)
Why might there be a problem with the jQuery JS?

br, Chris



Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:

Looks good.

I've just added an AjaxFormChoiceComponentUpdatingBehavior to wicket-examples' 
RadioGroupPage and it worked as expected.

Which Wicket version? Can you create a quickstart?

Have fun
Sven

On 18.04.2015 13:19, Chris wrote:

The html is as follows:

  wicket:panel
 form wicket:id=form class=form
div class=rating wicket:id=group
   input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
   ...
/div
 /form
/wicket:panel

best regards, Chris



Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:

Hi Sven,

the form is added to a panel.

Chris



Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:

Hi,

is your RadioGroup is bound to wicket:container in your markup?

Sven

On 18.04.2015 07:00, Chris wrote:

Hi all,

I have a radio group with different radio choices and I would like to add ajax 
behavior to the group.
With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate is 
never called currently.

How to fix this?



Form form = new Form(form);
RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, new 
ModelRadioChoice() {...}

RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
ModelRadioChoice(1));
RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
ModelRadioChoice(2));
radioGroup.add(radio1);
radioGroupd.add(Radio2);

form.add(radioGroup);

radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
}
});

Thanks, Chris
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

there is the JS plugin to detect changes in attributes (this might help to 
detect changes in the star-rating.
http://meetselva.github.io/attrchange/ http://meetselva.github.io/attrchange/
This works fine in a pure html-file, but in Wicket the JS function is not 
called (see below). I have created a quick start project: 
https://github.com/cat1000/AttrChange https://github.com/cat1000/AttrChange

Would you mind to have a look at it?

$attrchange.attrchange({
trackValues: true,
callback: function(e) {

}
  });

Thanks, Chris


 Am 18.04.2015 um 14:41 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 I tried following function but that still does only work with JQuery Rating 
 JS disabled.
 With JQuery Rating, the function is not called.
 
   $('input[name=field1_type]').change(function() {
trigger('click');
   });
 
 
 Below is the HTML code when Rating JS is enabled:
 
 div class=rating id=field1__type1482
span class=star-rating-controldiv 
 class=rating-cancela title=Cancel Rating/a/div
   div role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field11489a 
 title=radio16radio16/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field2148aa 
 title=radio17radio17/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field3148ba 
 title=radio18radio18/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field4148ca 
 title=radio19radio19/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live id=tt1__field5148da 
 title=radio20radio20/a/div/spaninput name=field1_type 
 type=radio class=star wicket-field1__type1482 star-rating-applied 
 id=tt1__field11489 value=radio16 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field2148a 
 value=radio17 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field3148b 
 value=radio18 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field4148c 
 value=radio19 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field5148d 
 value=radio20 style=display: none;
/div
 
 
 br Chris
 
 
 Am 18.04.2015 um 13:46 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 does the JS trigger click() on the radio when the user selects a rating? 
 When not, check for a callback to trigger click() by yourself.
 
 Regards
 Sven
 
 
 On 18.04.2015 13:34, Chris wrote:
 Hi Sven,
 
 thanks a lot for your help!
 I am using the jquery star rating JS to replace the radio boxes through 
 stars - with that it does not work. Without it I just tried it and AJAX 
 works (thanks for your feedback!)
 Why might there be a problem with the jQuery JS?
 
 br, Chris
 
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
form wicket:id=form class=form
   div class=rating wicket:id=group
  input wicket:id=radio1 type=radio/
 input wicket:id=radio2 type=radio/
  ...
   /div
/form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to 
 add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the 
 #onUpdate is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new 
 RadioGroupRadioChoice(group, new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new 

Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

the form is added to a panel.

Chris


 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to add 
 ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate is 
 never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, 
 new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
 protected void onUpdate(AjaxRequestTarget target) {
 // Ajax actions here
 }
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-18 Thread Sven Meier

Looks good.

I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
wicket-examples' RadioGroupPage and it worked as expected.


Which Wicket version? Can you create a quickstart?

Have fun
Sven

On 18.04.2015 13:19, Chris wrote:

The html is as follows:

  wicket:panel
 form wicket:id=form class=form
div class=rating wicket:id=group
   input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
   ...
/div
 /form
/wicket:panel

best regards, Chris



Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:

Hi Sven,

the form is added to a panel.

Chris



Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:

Hi,

is your RadioGroup is bound to wicket:container in your markup?

Sven

On 18.04.2015 07:00, Chris wrote:

Hi all,

I have a radio group with different radio choices and I would like to add ajax 
behavior to the group.
With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate is 
never called currently.

How to fix this?



Form form = new Form(form);
RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, new 
ModelRadioChoice() {...}

RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
ModelRadioChoice(1));
RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
ModelRadioChoice(2));
radioGroup.add(radio1);
radioGroupd.add(Radio2);

form.add(radioGroup);

radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
}
});

Thanks, Chris
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-18 Thread Chris
The html is as follows:

 wicket:panel
form wicket:id=form class=form
   div class=rating wicket:id=group
  input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
  ...
   /div
/form
/wicket:panel

best regards, Chris


 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to add 
 ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate is 
 never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, 
 new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
}
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-18 Thread Sven Meier

Hi,

please give us the url of the plugin you're trying to use.

Sven

On 18.04.2015 16:44, Chris wrote:

Hi Sven,

there is the JS plugin to detect changes in attributes (this might help to 
detect changes in the star-rating.
http://meetselva.github.io/attrchange/ http://meetselva.github.io/attrchange/
This works fine in a pure html-file, but in Wicket the JS function is not called (see 
below). I have created a quick start project: https://github.com/cat1000/AttrChange 
https://github.com/cat1000/AttrChange

Would you mind to have a look at it?

$attrchange.attrchange({
trackValues: true,
callback: function(e) {

}
   });

Thanks, Chris



Am 18.04.2015 um 14:41 schrieb Chris chris...@gmx.at:

Hi Sven,

I tried following function but that still does only work with JQuery Rating JS 
disabled.
With JQuery Rating, the function is not called.

   $('input[name=field1_type]').change(function() {
trigger('click');
   });


Below is the HTML code when Rating JS is enabled:

div class=rating id=field1__type1482
span class=star-rating-controldiv class=rating-cancela title=Cancel 
Rating/a/div
div role=text aria-label= class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied star-rating-live star-rating-on id=tt1__field11489a title=radio16radio16/a/divdiv role=text aria-label= class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied star-rating-live star-rating-on 
id=tt1__field2148aa title=radio17radio17/a/divdiv role=text aria-label= class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied star-rating-live star-rating-on id=tt1__field3148ba title=radio18radio18/a/divdiv role=text aria-label= class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied star-rating-live 
star-rating-on id=tt1__field4148ca title=radio19radio19/a/divdiv role=text aria-label= class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied star-rating-live id=tt1__field5148da title=radio20radio20/a/div/spaninput name=field1_type type=radio class=star wicket-field1__type1482 star-rating-applied 
id=tt1__field11489 value=radio16 style=display: none;
input name=field1_type type=radio class=star wicket-field1__type1482 
star-rating-applied id=tt1__field2148a value=radio17 style=display: none;
input name=field1_type type=radio class=star wicket-field1__type1482 
star-rating-applied id=tt1__field3148b value=radio18 style=display: none;
input name=field1_type type=radio class=star wicket-field1__type1482 
star-rating-applied id=tt1__field4148c value=radio19 style=display: none;
input name=field1_type type=radio class=star wicket-field1__type1482 
star-rating-applied id=tt1__field5148d value=radio20 style=display: none;
/div


br Chris



Am 18.04.2015 um 13:46 schrieb Sven Meier s...@meiers.net:

Hi Chris,

does the JS trigger click() on the radio when the user selects a rating? When 
not, check for a callback to trigger click() by yourself.

Regards
Sven


On 18.04.2015 13:34, Chris wrote:

Hi Sven,

thanks a lot for your help!
I am using the jquery star rating JS to replace the radio boxes through stars - 
with that it does not work. Without it I just tried it and AJAX works (thanks 
for your feedback!)
Why might there be a problem with the jQuery JS?

br, Chris



Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:

Looks good.

I've just added an AjaxFormChoiceComponentUpdatingBehavior to wicket-examples' 
RadioGroupPage and it worked as expected.

Which Wicket version? Can you create a quickstart?

Have fun
Sven

On 18.04.2015 13:19, Chris wrote:

The html is as follows:

wicket:panel
form wicket:id=form class=form
   div class=rating wicket:id=group
  input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
  ...
   /div
/form
/wicket:panel

best regards, Chris



Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:

Hi Sven,

the form is added to a panel.

Chris



Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:

Hi,

is your RadioGroup is bound to wicket:container in your markup?

Sven

On 18.04.2015 07:00, Chris wrote:

Hi all,

I have a radio group with different radio choices and I would like to add ajax 
behavior to the group.
With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate is 
never called currently.

How to fix this?



Form form = new Form(form);
RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, new 
ModelRadioChoice() {...}

RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
ModelRadioChoice(1));
RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
ModelRadioChoice(2));
radioGroup.add(radio1);
radioGroupd.add(Radio2);

form.add(radioGroup);

radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
  

Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

here is the URL: http://meetselva.github.io/attrchange/ 
http://meetselva.github.io/attrchange/

the attrchange plugin now basically works but I am still figuring out if it is 
possible to use this to detect changes in the star rating:
The star rating plugin renders for each input field additional a div element 
and if the star is shown a certain value is added to the class attribute, e.g. 
star-rating-on.

div role=text aria-label= class=star-rating rater-0 star wicket__type17d9 
star-rating-applied star-rating-live id=tt1__field117e0a 
title=radio16radio16/a/div

The plugin of the star rating can be found here: 
https://www.fyneworks.com/jquery/star-rating/ 
https://www.fyneworks.com/jquery/star-rating/

Chris


 Am 18.04.2015 um 18:28 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 please give us the url of the plugin you're trying to use.
 
 Sven
 
 On 18.04.2015 16:44, Chris wrote:
 Hi Sven,
 
 there is the JS plugin to detect changes in attributes (this might help to 
 detect changes in the star-rating.
 http://meetselva.github.io/attrchange/ 
 http://meetselva.github.io/attrchange/
 This works fine in a pure html-file, but in Wicket the JS function is not 
 called (see below). I have created a quick start project: 
 https://github.com/cat1000/AttrChange https://github.com/cat1000/AttrChange
 
 Would you mind to have a look at it?
 
 $attrchange.attrchange({
  trackValues: true,
  callback: function(e) {
 
  }
   });
 
 Thanks, Chris
 
 
 Am 18.04.2015 um 14:41 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 I tried following function but that still does only work with JQuery Rating 
 JS disabled.
 With JQuery Rating, the function is not called.
 
   $('input[name=field1_type]').change(function() {
trigger('click');
   });
 
 
 Below is the HTML code when Rating JS is enabled:
 
 div class=rating id=field1__type1482
span class=star-rating-controldiv 
 class=rating-cancela title=Cancel Rating/a/div
 div role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field11489a 
 title=radio16radio16/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field2148aa 
 title=radio17radio17/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field3148ba 
 title=radio18radio18/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live star-rating-on id=tt1__field4148ca 
 title=radio19radio19/a/divdiv role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied 
 star-rating-live id=tt1__field5148da 
 title=radio20radio20/a/div/spaninput name=field1_type 
 type=radio class=star wicket-field1__type1482 star-rating-applied 
 id=tt1__field11489 value=radio16 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field2148a 
 value=radio17 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field3148b 
 value=radio18 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field4148c 
 value=radio19 style=display: none;
input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field5148d 
 value=radio20 style=display: none;
/div
 
 
 br Chris
 
 
 Am 18.04.2015 um 13:46 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 does the JS trigger click() on the radio when the user selects a rating? 
 When not, check for a callback to trigger click() by yourself.
 
 Regards
 Sven
 
 
 On 18.04.2015 13:34, Chris wrote:
 Hi Sven,
 
 thanks a lot for your help!
 I am using the jquery star rating JS to replace the radio boxes through 
 stars - with that it does not work. Without it I just tried it and AJAX 
 works (thanks for your feedback!)
 Why might there be a problem with the jQuery JS?
 
 br, Chris
 
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
form wicket:id=form class=form
   div class=rating wicket:id=group
  input wicket:id=radio1 type=radio/
   input wicket:id=radio2 type=radio/
  ...
   /div
/form
 /wicket:panel
 
 best 

Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

I think that the solution (star-rating as ajax) might be something like that in 
Javascript:

var $attrchange = $('div', '.star-rating-control');
$attrchange.attrchange({
trackValues: true,
callback: function (e) {
if ( $( this ).hasClass( star-rating-on ) ) {
$('input[name=radio1]').trigger('click');
}
}
});

The method #AjaxFormChoiceComponentUpdatingBehavior is now called correctly.

br Chris

 Am 18.04.2015 um 18:38 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 here is the URL: http://meetselva.github.io/attrchange/ 
 http://meetselva.github.io/attrchange/
 
 the attrchange plugin now basically works but I am still figuring out if it 
 is possible to use this to detect changes in the star rating:
 The star rating plugin renders for each input field additional a div element 
 and if the star is shown a certain value is added to the class attribute, 
 e.g. star-rating-on.
 
 div role=text aria-label= class=star-rating rater-0 star 
 wicket__type17d9 star-rating-applied star-rating-live 
 id=tt1__field117e0a title=radio16radio16/a/div
   
 The plugin of the star rating can be found here: 
 https://www.fyneworks.com/jquery/star-rating/ 
 https://www.fyneworks.com/jquery/star-rating/
 
 Chris
 
 
 Am 18.04.2015 um 18:28 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 please give us the url of the plugin you're trying to use.
 
 Sven
 
 On 18.04.2015 16:44, Chris wrote:
 Hi Sven,
 
 there is the JS plugin to detect changes in attributes (this might help to 
 detect changes in the star-rating.
 http://meetselva.github.io/attrchange/ 
 http://meetselva.github.io/attrchange/
 This works fine in a pure html-file, but in Wicket the JS function is not 
 called (see below). I have created a quick start project: 
 https://github.com/cat1000/AttrChange 
 https://github.com/cat1000/AttrChange
 
 Would you mind to have a look at it?
 
 $attrchange.attrchange({
 trackValues: true,
 callback: function(e) {
 
 }
  });
 
 Thanks, Chris
 
 
 Am 18.04.2015 um 14:41 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 I tried following function but that still does only work with JQuery 
 Rating JS disabled.
 With JQuery Rating, the function is not called.
 
  $('input[name=field1_type]').change(function() {
   trigger('click');
  });
 
 
 Below is the HTML code when Rating JS is enabled:
 
 div class=rating id=field1__type1482
   span class=star-rating-controldiv 
 class=rating-cancela title=Cancel Rating/a/div
div role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field11489a title=radio16radio16/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field2148aa title=radio17radio17/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field3148ba title=radio18radio18/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field4148ca title=radio19radio19/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live id=tt1__field5148da 
 title=radio20radio20/a/div/spaninput name=field1_type 
 type=radio class=star wicket-field1__type1482 star-rating-applied 
 id=tt1__field11489 value=radio16 style=display: none;
   input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field2148a 
 value=radio17 style=display: none;
   input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field3148b 
 value=radio18 style=display: none;
   input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field4148c 
 value=radio19 style=display: none;
   input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field5148d 
 value=radio20 style=display: none;
   /div
 
 
 br Chris
 
 
 Am 18.04.2015 um 13:46 schrieb Sven Meier s...@meiers.net:
 
 Hi Chris,
 
 does the JS trigger click() on the radio when the user selects a rating? 
 When not, check for a callback to trigger click() by yourself.
 
 Regards
 Sven
 
 
 On 18.04.2015 13:34, Chris wrote:
 Hi Sven,
 
 thanks a lot for your help!
 I am using the jquery star rating JS to replace the radio boxes through 
 stars - with that it does not work. Without it I just tried it and AJAX 
 works (thanks for your feedback!)
 Why might there 

Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

there is a JS function provided by the Star Rating plugin which provides the 
callback function:
 $('.auto-submit-star').rating({
callback: function(value, link){
alert(value);
 
}
  });

What I do not quite understand is that I have to load the rating-JS file via 
- final ResourceReference rating = new 
JavaScriptResourceReference(RecommenderPage.class, „js/jquery.rating.js“). In 
the page I am using a HeaderResponseContainer.
Other Javascript libraries work when I put them directly in the wicket:head 
section of the html.

Moreover, if I load the  $('.auto-submit-star').rating function via 
- response.render(OnDomReadyHeaderItem.forScript(load();)); 
the function is not executed. I have to provide it in a 
$(document).ready(function(). 
Isn’t this the same?

best regards, Chris


 Am 18.04.2015 um 18:49 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 I think that the solution (star-rating as ajax) might be something like that 
 in Javascript:
 
 var $attrchange = $('div', '.star-rating-control');
$attrchange.attrchange({
trackValues: true,
callback: function (e) {
if ( $( this ).hasClass( star-rating-on ) ) {
$('input[name=radio1]').trigger('click');
}
}
});
 
 The method #AjaxFormChoiceComponentUpdatingBehavior is now called correctly.
 
 br Chris
 
 Am 18.04.2015 um 18:38 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 here is the URL: http://meetselva.github.io/attrchange/ 
 http://meetselva.github.io/attrchange/
 
 the attrchange plugin now basically works but I am still figuring out if it 
 is possible to use this to detect changes in the star rating:
 The star rating plugin renders for each input field additional a div element 
 and if the star is shown a certain value is added to the class attribute, 
 e.g. star-rating-on.
 
 div role=text aria-label= class=star-rating rater-0 star 
 wicket__type17d9 star-rating-applied star-rating-live 
 id=tt1__field117e0a title=radio16radio16/a/div
  
 The plugin of the star rating can be found here: 
 https://www.fyneworks.com/jquery/star-rating/ 
 https://www.fyneworks.com/jquery/star-rating/
 
 Chris
 
 
 Am 18.04.2015 um 18:28 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 please give us the url of the plugin you're trying to use.
 
 Sven
 
 On 18.04.2015 16:44, Chris wrote:
 Hi Sven,
 
 there is the JS plugin to detect changes in attributes (this might help to 
 detect changes in the star-rating.
 http://meetselva.github.io/attrchange/ 
 http://meetselva.github.io/attrchange/
 This works fine in a pure html-file, but in Wicket the JS function is not 
 called (see below). I have created a quick start project: 
 https://github.com/cat1000/AttrChange 
 https://github.com/cat1000/AttrChange
 
 Would you mind to have a look at it?
 
 $attrchange.attrchange({
trackValues: true,
callback: function(e) {
 
}
 });
 
 Thanks, Chris
 
 
 Am 18.04.2015 um 14:41 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 I tried following function but that still does only work with JQuery 
 Rating JS disabled.
 With JQuery Rating, the function is not called.
 
 $('input[name=field1_type]').change(function() {
  trigger('click');
 });
 
 
 Below is the HTML code when Rating JS is enabled:
 
 div class=rating id=field1__type1482
  span class=star-rating-controldiv 
 class=rating-cancela title=Cancel Rating/a/div
   div role=text aria-label= 
 class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field11489a title=radio16radio16/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field2148aa title=radio17radio17/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field3148ba title=radio18radio18/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live star-rating-on 
 id=tt1__field4148ca title=radio19radio19/a/divdiv role=text 
 aria-label= class=star-rating rater-0 star wicket-field1__type1482 
 star-rating-applied star-rating-live id=tt1__field5148da 
 title=radio20radio20/a/div/spaninput name=field1_type 
 type=radio class=star wicket-field1__type1482 star-rating-applied 
 id=tt1__field11489 value=radio16 style=display: none;
  input name=field1_type type=radio class=star 
 wicket-field1__type1482 star-rating-applied id=tt1__field2148a 
 value=radio17 style=display: none;
  input name=field1_type type=radio class=star 
 wicket-field1__type1482 

Re: Radio group add ajax behavior

2015-04-18 Thread Sebastien
Hi Chris, what is load(); ? isn't it a scope issue again ?
On Apr 18, 2015 9:48 PM, Chris chris...@gmx.at wrote:

 Hi Sven,

 there is a JS function provided by the Star Rating plugin which provides
 the callback function:
  $('.auto-submit-star').rating({
 callback: function(value, link){
 alert(value);

 }
   });

 What I do not quite understand is that I have to load the rating-JS file
 via
 - final ResourceReference rating = new
 JavaScriptResourceReference(RecommenderPage.class, „js/jquery.rating.js“).
 In the page I am using a HeaderResponseContainer.
 Other Javascript libraries work when I put them directly in the
 wicket:head section of the html.

 Moreover, if I load the  $('.auto-submit-star').rating function via
 - response.render(OnDomReadyHeaderItem.forScript(load();));
 the function is not executed. I have to provide it in a
 $(document).ready(function().
 Isn’t this the same?

 best regards, Chris


  Am 18.04.2015 um 18:49 schrieb Chris chris...@gmx.at:
 
  Hi Sven,
 
  I think that the solution (star-rating as ajax) might be something like
 that in Javascript:
 
  var $attrchange = $('div', '.star-rating-control');
 $attrchange.attrchange({
 trackValues: true,
 callback: function (e) {
 if ( $( this ).hasClass( star-rating-on ) ) {
 $('input[name=radio1]').trigger('click');
 }
 }
 });
 
  The method #AjaxFormChoiceComponentUpdatingBehavior is now called
 correctly.
 
  br Chris
 
  Am 18.04.2015 um 18:38 schrieb Chris chris...@gmx.at:
 
  Hi Sven,
 
  here is the URL: http://meetselva.github.io/attrchange/ 
 http://meetselva.github.io/attrchange/
 
  the attrchange plugin now basically works but I am still figuring out
 if it is possible to use this to detect changes in the star rating:
  The star rating plugin renders for each input field additional a div
 element and if the star is shown a certain value is added to the class
 attribute, e.g. star-rating-on.
 
  div role=text aria-label= class=star-rating rater-0 star
 wicket__type17d9 star-rating-applied star-rating-live
 id=tt1__field117e0a title=radio16radio16/a/div
 
  The plugin of the star rating can be found here:
 https://www.fyneworks.com/jquery/star-rating/ 
 https://www.fyneworks.com/jquery/star-rating/
 
  Chris
 
 
  Am 18.04.2015 um 18:28 schrieb Sven Meier s...@meiers.net:
 
  Hi,
 
  please give us the url of the plugin you're trying to use.
 
  Sven
 
  On 18.04.2015 16:44, Chris wrote:
  Hi Sven,
 
  there is the JS plugin to detect changes in attributes (this might
 help to detect changes in the star-rating.
  http://meetselva.github.io/attrchange/ 
 http://meetselva.github.io/attrchange/
  This works fine in a pure html-file, but in Wicket the JS function is
 not called (see below). I have created a quick start project:
 https://github.com/cat1000/AttrChange 
 https://github.com/cat1000/AttrChange
 
  Would you mind to have a look at it?
 
  $attrchange.attrchange({
 trackValues: true,
 callback: function(e) {
 
 }
  });
 
  Thanks, Chris
 
 
  Am 18.04.2015 um 14:41 schrieb Chris chris...@gmx.at:
 
  Hi Sven,
 
  I tried following function but that still does only work with JQuery
 Rating JS disabled.
  With JQuery Rating, the function is not called.
 
  $('input[name=field1_type]').change(function() {
   trigger('click');
  });
 
 
  Below is the HTML code when Rating JS is enabled:
 
  div class=rating id=field1__type1482
   span class=star-rating-controldiv
 class=rating-cancela title=Cancel Rating/a/div
div role=text aria-label=
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied
 star-rating-live star-rating-on id=tt1__field11489a
 title=radio16radio16/a/divdiv role=text aria-label=
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied
 star-rating-live star-rating-on id=tt1__field2148aa
 title=radio17radio17/a/divdiv role=text aria-label=
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied
 star-rating-live star-rating-on id=tt1__field3148ba
 title=radio18radio18/a/divdiv role=text aria-label=
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied
 star-rating-live star-rating-on id=tt1__field4148ca
 title=radio19radio19/a/divdiv role=text aria-label=
 class=star-rating rater-0 star wicket-field1__type1482 star-rating-applied
 star-rating-live id=tt1__field5148da
 title=radio20radio20/a/div/spaninput name=field1_type
 type=radio class=star wicket-field1__type1482 star-rating-applied
 id=tt1__field11489 value=radio16 style=display: none;
   input name=field1_type type=radio class=star
 wicket-field1__type1482 star-rating-applied id=tt1__field2148a
 value=radio17 

Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven,

have you added the AjaxFormChoicecomponentUpdatingBehaviour in this example to 
the group?

group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
System.out.println(The selected value is  + 
getComponent().getDefaultModelObjectAsString());
}
});

Thanks, Chris

 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
  wicket:panel
 form wicket:id=form class=form
div class=rating wicket:id=group
   input wicket:id=radio1 type=radio/
input wicket:id=radio2 type=radio/
   ...
/div
 /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to add 
 ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate 
 is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, 
 new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
}
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi Sven  all,

when using the JS Star Rating plugin 
(https://www.fyneworks.com/jquery/star-rating 
https://www.fyneworks.com/jquery/star-rating, star images instead of radio 
boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not work anymore.

I have created a sample project based on the wicket-example „RadioGroupPage“ 
and put it here: https://github.com/cat1000/StarRating 
https://github.com/cat1000/StarRating

It would be great if someone could have a look the conflict.

Thanks a lot,
Chris





 Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 have you added the AjaxFormChoicecomponentUpdatingBehaviour in this example 
 to the group?
 
 group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
// Ajax actions here
System.out.println(The selected value is  + 
 getComponent().getDefaultModelObjectAsString());
}
 });
 
 Thanks, Chris
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
form wicket:id=form class=form
   div class=rating wicket:id=group
  input wicket:id=radio1 type=radio/
   input wicket:id=radio2 type=radio/
  ...
   /div
/form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to 
 add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate 
 is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new 
 RadioGroupRadioChoice(group, new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   protected void onUpdate(AjaxRequestTarget target) {
   // Ajax actions here
   }
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: Radio group add ajax behavior

2015-04-18 Thread Chris
Hi,

as shown in https://github.com/cat1000/StarRating , Ajax works but there is 
still a problem with the callback function:

The callback function offered by the Rating plugin causes an infinite loop.

$('.auto-submit-star').rating({
callback: function () {…}
}

br, Chris


 Am 19.04.2015 um 02:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven  all,
 
 when using the JS Star Rating plugin 
 (https://www.fyneworks.com/jquery/star-rating 
 https://www.fyneworks.com/jquery/star-rating, star images instead of radio 
 boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not work anymore.
 
 I have created a sample project based on the wicket-example „RadioGroupPage“ 
 and put it here: https://github.com/cat1000/StarRating 
 https://github.com/cat1000/StarRating
 
 It would be great if someone could have a look the conflict.
 
 Thanks a lot,
 Chris
 
 
 
 
 
 Am 18.04.2015 um 23:43 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 have you added the AjaxFormChoicecomponentUpdatingBehaviour in this example 
 to the group?
 
 group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   protected void onUpdate(AjaxRequestTarget target) {
   // Ajax actions here
   System.out.println(The selected value is  + 
 getComponent().getDefaultModelObjectAsString());
   }
 });
 
 Thanks, Chris
 
 Am 18.04.2015 um 13:24 schrieb Sven Meier s...@meiers.net:
 
 Looks good.
 
 I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
 wicket-examples' RadioGroupPage and it worked as expected.
 
 Which Wicket version? Can you create a quickstart?
 
 Have fun
 Sven
 
 On 18.04.2015 13:19, Chris wrote:
 The html is as follows:
 
 wicket:panel
   form wicket:id=form class=form
  div class=rating wicket:id=group
 input wicket:id=radio1 type=radio/
  input wicket:id=radio2 type=radio/
 ...
  /div
   /form
 /wicket:panel
 
 best regards, Chris
 
 
 Am 18.04.2015 um 13:14 schrieb Chris chris...@gmx.at:
 
 Hi Sven,
 
 the form is added to a panel.
 
 Chris
 
 
 Am 18.04.2015 um 11:26 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 is your RadioGroup is bound to wicket:container in your markup?
 
 Sven
 
 On 18.04.2015 07:00, Chris wrote:
 Hi all,
 
 I have a radio group with different radio choices and I would like to 
 add ajax behavior to the group.
 With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate 
 is never called currently.
 
 How to fix this?
 
 
 
 Form form = new Form(form);
 RadioGroupRadioChoice radioGroup = new 
 RadioGroupRadioChoice(group, new ModelRadioChoice() {...}
 
 RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
 ModelRadioChoice(1));
 RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
 ModelRadioChoice(2));
 radioGroup.add(radio1);
 radioGroupd.add(Radio2);
 
 form.add(radioGroup);
 
 radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
  protected void onUpdate(AjaxRequestTarget target) {
  // Ajax actions here
  }
 });
 
 Thanks, Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Radio group add ajax behavior

2015-04-18 Thread Sven Meier

Hi,

is your RadioGroup is bound to wicket:container in your markup?

Sven

On 18.04.2015 07:00, Chris wrote:

Hi all,

I have a radio group with different radio choices and I would like to add ajax 
behavior to the group.
With the method #AjaxFormChoiceComponentUpdatingBehavior, the #onUpdate is 
never called currently.

How to fix this?



Form form = new Form(form);
RadioGroupRadioChoice radioGroup = new RadioGroupRadioChoice(group, new 
ModelRadioChoice() {...}

RadioRadioChoice radio1 = new RadioRadioChoice(radio1, new 
ModelRadioChoice(1));
RadioRadioChoice radio2 = new RadioRadioChoice(radio2, new 
ModelRadioChoice(2));
radioGroup.add(radio1);
radioGroupd.add(Radio2);

form.add(radioGroup);

radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
 protected void onUpdate(AjaxRequestTarget target) {
 // Ajax actions here
 }
});

Thanks, Chris
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org