if you think any of this is a bug in wicket (no matter how small), please report it.
thanks,
jon
Antonio Casula wrote:
Yeah! this is the way! I will share the code when finished. Thanks again.
--- Maurice Marrink <[EMAIL PROTECTED]> wrote:
.append(popup.getPopupJavaScript()).append("\r\n\t\t}\r\n\t//-->\r\n</scAh yes, like I said I used my own custom implementation of onclicklink and now I remember why: they made handlecomponenttag final, arrrrgh ;)
Anyway here are my onclicklink and popupsettings, should work like a charm :)
Oh one more thing about the
popupScript.replaceAll("&",
"&"); forget about it, firefox can't handle it.
Should be no
problems without the replaceAll. If you want to read more about it google on:
"firefox javascript &"
Note you still might need to make a few modifications, since I have had a similar problem like yours but not completely identical.
Good luck,
Maurice
-----Oorspronkelijk bericht-----
Van: Antonio Casula [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 15 februari 2005 11:14
Aan: [email protected]
Onderwerp: RE: [Wicket-user] onClick event
Maurice, Thanks a lot for your help, but you still miss the target!
Now all we need to do is extend/overrideonClickLink
or make or own
implementation of Link, so that the javascript
function datePopup() is
triggered. There are several ways to do this and I
am confident you will
accomplish that part on your own.
Just that I need!
Seems I have to use handleComponentTag() but I dont understand how and where! I have tried to override this method without success. An I think there are some interfernce with getPopupJavaScript() method : .... public OnClickLink(String name, Serializable object, String expression) { super(name, object, expression); }
protected final void handleComponentTag(final ComponentTag tag) { // Add simple javascript on click handler that links to this // link's linkClicked method final String url = getURL().replaceAll("&", "&"); final PopupSettings popupSettings = getPopupSettings(); if (popupSettings != null) { popupSettings.setTarget("'" + url + "'"); String popupScript = popupSettings.getPopupJavaScript(); popupScript = popupScript.replaceAll("&", "&"); tag.put("onclick", popupScript); } else { tag.put("onclick", "location.href='" + url + "';"); } } ... What do you think?
Thanks again Antonio
--- Maurice Marrink <[EMAIL PROTECTED]> wrote:
theOk,
If you already have this working then it should be
relatively easy to
send the textfield value without submitting the
form.
Be ready for some dirty work though.
Here is what you need, we'll get to how you can do
it later ;)
- when the link /icon is clicked we need to get
here').valuefield value - then we need to trigger the popup with the value
Too get the value we need some javascript:
document.getElementById('text field id
someThen we need to trigger the popup I recommend something like: OnClickLink onClickLink = new OnClickLink("link") { public void linkClicked() { RequestCycle cycle = RequestCycle.get(); PageParameters params = new PageParameters(); cycle.setPage(cycle.getPageFactory().newPage (DatePickerPopupPage.class, params)); } }; onClickLink.setPopupSettings(makePopup(index)); //you probably need an index if you are going to use multiple datepickers on the same page, to keep track
private PopupSettings makePopup(int index) { PopupSettings popup = new PopupSettings(false, false, false, false, false); popup.setHeight(500); popup.setWidth(560); popup.setLocation(500, 200); popup.setWindowName("some name_" + index); popup.setFocus(true); return popup; }
Now to keep everything reusable we need to add
dynamicthat:
javascripting, I use the following trick to do
private class JavaScriptPanel extends PanelILinkListener.class);
{
/**
* Construct.
* @param componentName
*/
public JavaScriptPanel(String componentName, int
componentIndex)
{
super(componentName);
add(new Label("script", new IModel()
{
public Object getObject()
{
int index = componentIndex;
OnClickLink link = (OnClickLink)
parent.get("link");
String url =
getRequestCycle().urlFor(link,
PopupSettings popup = makePopup(index); popup.setTarget("'" + url.replaceAll("&", "&") + "'+'&param1='+ document.getElementById('text field id here').value"); StringBuffer buffer = new StringBuffer( "<script language=\"JavaScript1.1\">\r\n").append( "\t<!--\r\n\t\tfunction datePopup()\r\n\t\t{\r\n").append("\t\t\t")
onClickLinkript>"); return buffer.toString(); } public void setObject(Object object) { // not important } }).setShouldEscapeModelStrings(false)); } }
Now all we need to do is extend/override
or make or own
implementation of Link, so that the javascript
function datePopup() is
=== message truncated ===
ATTACHMENT part 2 application/octet-stream
name=OnClickLink.java
ATTACHMENT part 3 application/octet-stream
name=PopupSpecification.java
__________________________________ Do you Yahoo!? The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
