Modal dialog box to appear upon page load is too late

2014-01-08 Thread J.K. Baltzersen
Dear all,

I have subclassed ModalWindow to create a modal window that appears when a
page starts loading and disappears when page load is complete.

The window is added to the main panel of the page -- and has a corresponding
element in the markup.

This is my renderHead method:

public void renderHead(IHeaderResponse response) {
   
response.render(OnDomReadyHeaderItem.forScript(getWindowOpenJavaScript()));
response.render(OnLoadHeaderItem.forScript(getCloseJavacript()));
}

The purpose of the modal dialog box is to prevent the user from entering
data before the page has loaded completely. If the user does enter data
prematurely, his data may be ignored, and we want to avoid this.

Any tips to get the modal dialog box up at an earlier stage that please can
be provided will be greatly appreciated.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Modal-dialog-box-to-appear-upon-page-load-is-too-late-tp4663551.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: Modal dialog box to appear upon page load is too late

2014-01-08 Thread J.K. Baltzersen
Thanks.

I am not sure whether you meant after the div element or after the div start
tag. So I tried both.

After the element:

div wicket:id=loadModalWindow/div


And after the start tag:

div wicket:id=loadModalWindow/div

Both gave me this exception (which I did not before I started implementing
your advice):

Caused by:org.apache.wicket.WicketRuntimeException
Message: No Page found for component [OpenOnLoadModalWindow [Component id =
loadModalWindow]]

This is how the code looks like:

Label scriptLabel = new Label(js, loadModalWindow.renderScript());
add(loadModalWindow);
add(scriptLabel);

The amended code of OpenOnLoadModalWindow:

public void renderHead(IHeaderResponse response) {
response.render(OnLoadHeaderItem.forScript(getCloseJavacript()));
}

public final String renderScript() {
return getWindowOpenJavaScript();
}


Martin Grigorov-4 wrote
 [...]
 this will render the JS when the whole page DOM is constructed
 you can add 

  right after the modal's div
 and use a Label(js, getWindowOpenJavaScript())
 [...]

Best regards,
J.K. Baltzersen

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Modal-dialog-box-to-appear-upon-page-load-is-too-late-tp4663551p4663561.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: user activity disabled during page load

2013-12-20 Thread J.K. Baltzersen
Martin Grigorov-4 wrote
 .wicket-modal .w_close { display: none }
 
 You may make this CSS rule even more specific because it will affect all
 modal windows when it is applied.

I managed to implement this. However, the close (x) button is still there.
So the user may click it if he knows it is there or otherwise happens to
click in the right area.

Is there a CSS solution that gets rid of the close button from the web page
perspective altogether?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/user-activity-disabled-during-page-load-tp4662891p4663162.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: user activity disabled during page load

2013-12-11 Thread J.K. Baltzersen
Thanks, but it is not the confirmation dialog itself that is the problem, it
is the fact that the browser tries to leave the page.

If I disable the confirmation dialog, all that will happen is that the user
is thrown off the page without any confirmation. That is not what is
intended.

I have not called setResponsePage. All that I have done is overriden the
CloseButtonCallback, and that somehow causes a page switch (with a
confirmation dialog), which it -- in my humbe opinion -- should not.

That is, I am not just getting this annoying confirmation dialog. The user
is also thrown out (login page appears) if leave page is chosen. That is the
main problem. The confirmation dialog is secondary to that.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/user-activity-disabled-during-page-load-tp4662891p4662908.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: user activity disabled during page load

2013-12-11 Thread J.K. Baltzersen
I am not submitting a form. There is no submit button. I am invoking the
modal window upon wait for load of the page to complete (non-Ajax).

However, the setCloseButtonCallback includes an onCloseButtonClicked defined
and declared with an AjaxRequestTarget parameter.

If I remove the overridden callback, I don't have that problem, but then the
user may close the window at will and hence be able to do edit before the
page is completely loaded, which undermines the purpose of the dialog box.


Martin Grigorov-4 wrote
 Hi,
 
 Do you use *Ajax* button to submit the form ?
 If you use normal (non-Ajax) submit button then you will leave the page.





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/user-activity-disabled-during-page-load-tp4662891p4662910.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: user activity disabled during page load

2013-12-11 Thread J.K. Baltzersen
Thanks. I have the same concept with a different text in the alert.

As I cannot resolve why the page is being abandoned, I think the better
approach is, as you suggest, to make the close (x) button unavailable to the
user. I've had a look in this forum and elsewhere for specific solutions for
that.

Any concrete examples of implementations?


Martin Grigorov-4 wrote
 I'm not sure why it tries to leave the page in your case.
 
 You can also hide the x button with CSS rule, so your user won't be able
 to click it.





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/user-activity-disabled-during-page-load-tp4662891p4662912.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



user activity disabled during page load

2013-12-10 Thread J.K. Baltzersen
Dear all,

I have been having trouble with a page that is heavy in loading, especially
at client locations with low bandwidth. The main problem is that fields that
are updated by the user before load has completed are not saved in their
edited form.

I have made an attempt to solve this problem with a modal window based on
this:
http://apache-wicket.1842946.n4.nabble.com/opening-ModalWindow-on-page-load-td3055618.html

renderHead has been amended to:

public void renderHead(IHeaderResponse response) {
   
response.render(OnDomReadyHeaderItem.forScript(getWindowOpenJavaScript()));
response.render(OnLoadHeaderItem.forScript(getCloseJavacript()));
}

However, a problem with this approach is the modal window can be closed by
the user at will.

This problem, again, I have sought to resolve by amending the close
behavior:

private void initialize() {

setCloseButtonCallback(new CloseButtonCallback() {
@Override
public boolean onCloseButtonClicked(AjaxRequestTarget target) {
return false;
}
});

This works fine for modal window's case. However, I now suddenly get this
message: The page is asking you to confirm that you want to leave - data
you have entered may not be saved. With the options: Leave Page. Stay on
Page.

This behavior seems to show up no matter what if a new CloseButtonCallback
is implemented. If this behavior were non-present, everything would be fine.

I just want to disable user activity in the page before the entire page is
loaded.

I have looked into using an adaptation of the DisableComponentListener:
http://wicket.apache.org/guide/guide/chapter17.html#chapter17_6

But I have thus far failed to see how this can be applied when I am not
using Ajax in this instance.

Any tips that can please be provided for this task to move forward will be
greatly appreciated.

Thank you very much in advance.

Best regards,
J.K. Baltzersen



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/user-activity-disabled-during-page-load-tp4662891.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