Key Enter on Form Does not work on IE8

2012-01-22 Thread Krishna Mohan
I have a form and few panels in it.

In panel 'A' i have search button , panle 'A' consist of set of other panels 
'B'.
panel 'B' has few fields for example field 'F' 

Each panel is implemented in sepearate java class

I have requirement wherein after entering text in the field 'F' on press of 
"Enter" 
button search should be performed with out click of search button.

To achieve this i tried following snippet

 add(new AjaxEventBehavior("onkeypress")
  {
@Override protected CharSequence getCallbackScript(boolean 
onlyTargetActivePage)
{
  return generateCallbackScript("wicketAjaxGet('" + 
getCallbackUrl(onlyTargetActivePage) + "&" + KEYPRESS_PARAM + 
"='+wicketKeyCode(event)");
}

@Override protected void onEvent(AjaxRequestTarget target)
{
  String paramValue = 
RequestCycle.get().getRequest().getParameter(KEYPRESS_PARAM);
  int key = Integer.parseInt(paramValue);
if (key == 13)
{
   submitSearchForm();
 }
}

});
but using above the text in the field is cleared and get wrong search. but when 
i remove focus from the field and press "Enter" i get desired result.

My question here is how to perform search, remaining in the field(with focus in 
the field)

or their any other approach to get my requirement 

i also tried

  @Override protected void onInitialize()
  {
super.onInitialize();
PnWebForm form = findParent(PnWebForm.class);
if (form != null)
{
  form.setDefaultButton(this.pnWebSearchButton);
}
  }


Even this did not work and the problem is only with IE8 or its earlier 
versions, 
it works with Mozilla firefox,chrome,safari etc
  

Regards
Krishna


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



Execute Javascript after components of a certain type render

2012-01-22 Thread Alec Swan
Hello,

What is the best way to execute some Javascript code when components
of type IMyPanel render?

I was hoping that I could use
Application#addPostComponentOnBeforeRenderListener(..) and add a
listener that would add a behavior to each component of IMyPanel type.
The behavior would then execute append some Javascript in
onComponentTag() method. However, I can't seem to find the right type
of behavior to attach or maybe I should use a different
Application#addXXXListener(..) method.

Please help.

Thanks,

Alec

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



Re: AJAX Rating extension, multiple on a page

2012-01-22 Thread armhold
Just to be clear in case it wasn't obvious- thingBeingRated will be
serialized with the rest of your page if you take this approach. If it's not
serializable, use a reference (like a database ID) to look it up when
needed, instead of marking the object itself as final.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AJAX-Rating-extension-multiple-on-a-page-tp4317346p4318956.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AJAX Rating extension, multiple on a page

2012-01-22 Thread armhold
I've not used this component before, so take this with a grain of salt. 

But if you're overriding the RatingPanel.onRating(), you implicitly have
access to the RatingPanel via "this". You can access it in the onRating()
method, as well as any other accessible member/final field. So you could do
something like:

final Object thingBeingRated = ...;

  @Override 
  public void onRated(int rating, AjaxRequestTarget target) { 
  HomePage.rating.addRating(rating); 
  log.debug("thing being rated: " + thingBeingRated);
  } 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AJAX-Rating-extension-multiple-on-a-page-tp4317346p4318860.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AJAX Error in parsing: XML Parsing Error: not well-formed @L

2012-01-22 Thread Alec Swan
The following workaround works but violates encapsulation. Why doesn't
AjaxRequestTarget.AjaxHeaderResponse class escape special XML
characters?

public void renderHead(IHeaderResponse response) {
String scriptToRender = "if (1 == 1 && true)
alert('Hello!')";
if (scriptToRender != null) {
if (AjaxRequestTarget.get() != null) {
scriptToRender = scriptToRender.replace("&", "&");
// todo: escape other XML special characters
}
response.renderString(scriptToRender);
}
}

Thanks,

Alec

On Sun, Jan 22, 2012 at 12:14 AM, Alec Swan  wrote:
> Hello,
>
> I am using Wicket 1.4.17 and have a panel which implements
> IHeaderContributor as follows:
>
> public void renderHead(IHeaderResponse response) {
>  response.renderString("if (1 == 1 && true) 
> alert('Hello!')");
> }
>
> When the panel is updated as a part of AJAX request (by adding to ART)
> the following error is shown in Debugger:
>
> ERROR: Error in parsing: XML Parsing Error: not well-formed
> Location: http://localhost:8080/...
> Line Number 1, Column 67: xmlns:wicket="http://wicket.apache.org";>if (1 == 1 && true)
> alert('Hello!')
>
> Shouldn't ART's header contributor properly escape special XML
> characters such as &? How can I fix this?
>
> Thanks,
>
> Alec

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



Re: Nested Modal Window Problem - IE8 - 404 Error

2012-01-22 Thread ashindler
Thanks for you reply - I cleared the cache and I still get the same error.

Any other suggestions?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Nested-Modal-Window-Problem-IE8-404-Error-tp4311638p4318507.html
Sent from the Users forum mailing list archive at Nabble.com.

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