1

I have a purchases form that requires you to select a customer ID, currently it is just a dropdown list of Customer Names with their ID hidden.

What I want to do is instead of a dropdown list, there will be a hyperlinked select button that when clicked will open a popup box that allows them to search through a list of customers using whatever field they choose.

Now I have had no problem with making the popup box search through for a customer, I just don't know how to pass that data back to the main page. Are there any examples for this?

clifford.duke
  • 3,980
  • 10
  • 38
  • 63
  • Partial views, json, ajax? Call a controller action, return json, render a partial view directly into the page (DOM) - See http://stackoverflow.com/questions/3651171/asp-net-mvc-rendering-partial-view-with-jquery-ajax – SpaceBison Jun 26 '13 at 09:28

1 Answers1

2

There are some ways to send data from popup window to opener window:

1) use window.opener property in popup window:

function pick(data) {
  if (window.opener && !window.opener.closed)
    window.opener.document.anyForm.anyInput.value = data;
  window.close();
}

2) More exotic: use local storage to handle custom events from other window

look at sample

YD1m
  • 5,845
  • 2
  • 19
  • 23
  • Oh cool, Thanks! I didn't know javascript had a method to point back to the original window. That makes things so much easier than I thought. – clifford.duke Jun 26 '13 at 10:20