Onclick open new window and reload previous page - facebook

I trying to have a new window pop up to checkout at Paypal, OK. Problem is that if user goes back to add or take away items and click "checkout" again, the pop up does not work. The only solution I can think of is when customer submits form to check out, the action opens up a new window and reloads the page they were just on. Can this be done or is there another way?
checkoutPayment: ' {payment}',
paypal: '<form target="_blank" id="rcCartForm" action="https://www.paypal.com/cgi-bin/webscr;" method="post">' +

Related

On activate does not fire with my Modal/Pop-Up form to Requery

I have a modal/pop-up form frmEditContact open
on this form there is a combo box full of addressescmbAddressList, populated by a query.
when the user wants to add an address that doesn't exist there is a button that opens the frmAddress where they may add an address.
frmAddress allows them to enter an address to the list and gives the option to save, or cancel (both actions close the form after). with this form closed, the focus is now again on frmEditContact
I would like to repopulate the combo box using docmd.Requery cmbAddressList after they close the other form
I'm not sure where to handle this, I've tried On Avtivate, On Load, On Update, On Open, On Focus...but none of them fire as I keep the frmEditContact open when they are using the other form
is there a way to keep frmEditContact open the whole time, but still an action Event that will fire so that I can Requery? And does On Activate not work with modal forms?
You can requery the combo from frmAddress :
Forms!frmEditContact.cmbAddressList.Requery
I suggest you use the save button to run the requery.
Try this in your frmEditContact code.
DoCmd.OpenForm "frmAddress", acNormal, WindowMode:=acDialog
Me.cmbAddressList.Requery
Since frmAddress is opened in dialog mode, the next line (Requery) will not run until after frmAddress is closed.

How FB refreshes the page without reloading it (xmlHttpRequest) but Back button still works?

How FB refreshes the page without reloading it (xmlHttpRequest) but Back/Forward Buttons still work as usual?
It's not about using history.pushState() methods. PushState() only changes URL-string but does nothing to get previous looking page after you click Back Button. So it's smth different.
Here's my code and example.
I have such site (look at the pic below). Header-div and Content-div. At the begining when you first time open it, the URL is mysite.com/page1.php. I want to change content in Content-div without reloading page. Just new info should appear in Content-div. And the URL should change to mysite.com/page2.php.
Here's HTML-code.
<div id="content"></div>
Reload Content
Here's JS-code to it.
document.getElementById("relaodLink").onclick = function() {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "page2.php", true);
xmlHttp.send();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
document.getElementById("content").innerHTML = xmlHttp.responseText;
}
}
return false;
}
So Header should not reload after pressing relaodLink, just content in Content-div changes. And most important: URL should change like page was really reloaded. Back Button allows to go to mysite.com/page1.php and then Forward Button allows to go back to mysite.com/page2.php again. With history.pushState() methods it doesn't work. But in FB Back and Forward Buttons work fine. How to make it?
(source: ljplus.ru)
This is an excellent question. If you observe, you can notice that the back buttons and forward buttons will work in gmail also though it is completely built on Ajax.
The browser back and forward buttons work on storing what is there in the address bar. So in Ajax, if you never change what is there in the address bar, it doesn't go into the history and hence back and forward buttons don't work.
For this to work, you need to append something to the address bar constantly.
For example : In gmail,
When Inbox is clicked - https://mail.google.com/mail/?tab=mm#inbox
When Starred is clicked - https://mail.google.com/mail/?tab=mm#starred
When Sent is clicked - https://mail.google.com/mail/?tab=mm#sent
So in this way, gmail keeps appending to address bar. Hence history is preserved. The same goes with facebook also. Though the page is not refreshed, the location in address bar changed - that's the key here !!
I hope it helps you !

nyroModal v2: How to validate form opened in iframe?

I'm trying to figure out how to validate a form opened using nyroModal.
The page is being opened as below on click of a button:
$(function() {
$('.btnedit').click(function() {
$.nmManual('form_page.php);
});
});
On the form that opens up, I have a few fields that are mandatory and a cancel & submit button.
<a class="nyroModalClose button" href="#" id="btn_submit">Submit</a>
On clicking of the submit button, I want to make sure the mandatory fields have value. If no, an error message should be displayed & the modal window should not close.
I'm trying to use the jquery validation plugin, but without success. The modal window always closes irrespective of the validation scripts.
I haven't found much info regarding form validation in a modal window. Is this not a preferred approach?
Thanks in advance.
I'm not able to help you about the jquery validation plugin in a modal window, but I know that using the instruction $.nmManual in that way, the form will not be placed inside the iframe tag, and if I remember correctly the content of new page will be added without header and body tags, so in a word incorrectly. I guess this can produce no validation.
To successfully open an iframe you need to use filters as described here:
Open iframe manually in nyroModal?
I hope this can help you.

How to create a "New xxx" popup?

I have a Grid object and added a [ (+) New Client ] button which I'd like to open a popup form to create the new client with a couple fields.
I've looked at the code examples in the website but haven't found how to do it (sorry if I've missed something).
This is the current page code:
function page_clients_listing($p){
$g = $p->add('Grid');
$g->addColumn('text','first_name');
$g->addColumn('text','last_name');
$g->addColumn('inline','telephone');
$g->addColumn('expander','comments');
$g->setSource('client');
$g->addButton('With Icon')->set('Add New Client')->setIcon('Plus');
}
Thanks in advance!
You can either create a popup or a dialog. Dialog is based on jQuery UI dialog implementation. Popups are likely to be blocked and are harder to control.
This is actually working for any object (you can apply to view, button, image, icon, etc), but I'll use button).
$b=$g->addButton('Add New Client')->setIcon('Plus');
$b->js('click')->univ()->frameURL($title,$url);
// OR
$b->js('click')->univ()->dialogURL($title,$url);
$url would most likely be returned by api->getDestinationURL(). The other page would be loaded and scripts on that page will be evaluated. Let's say you are on other page and now need to close the window.
$result = $this->addButton('Close')->js('click')->univ()->closeDialog();
closeDialog() returns a jQuery chain object pointing to a view which originally opened the frame. As a result if you do $result->hide(); then after dialog is closed, the original button ('add new client') will also be hidden.
Here is example to show some additional things you can do with frames, reloading and custom event handlers:
http://agiletoolkit.org/example/refresh1

Struts 2: redirect-action ? From on page to another and back again

i have a jsp page that has a submit button. This button is linked with another jsp page.
So lets assume my stuts file looks like this:
B.jsp
So now the submit button being on page "A.jsp" will take me to B.jsp. This works. The problem is that i want to do the following:
press on the submit button on page A.jsp , go to B.jsp where i will press again a button and go back to A.jsp . The problem is that to page B.jsp go many pages, so B.jsp has to know when pressing the submit button to which page will take me back , in this case A.jsp again.
So in a few words, B.jsp has to know from which page i came from so that i can go back again by pressing a submit button (this could be a parameter that would be sent back to A.jsp again, but does not really matter at the current point)
A.jsp -> B.jsp -> A.jsp
C.jsp -> B.jsp -> C.jsp
I guess your B.jsp is some sort of general result page, which displays a message and invites the user to return to the previous page -before the submission. If you dont want to read the browser history with javascript (I woudn't) the standard approach is to pass the "returnUrl" as a property of your Action. This seems straighforward to me.