-1

I'm trying to populate a textbox onlick of a hyperlink. Following are the steps that would better explain the scenario : 1. On click of a hyperlink a new window(small) is opened which has a number that is generated from database. There is an OK button if the user agrees with the number. 2. Onlick of OK button the number has to be populated into the textbox from which the entire process started.

I have generated the number in the small window but I'm failing to populate it in the textbox. My approach till now is onlick of the hyperlink I have opened a new window using window.open(). And onload of the new jsp in the small window I've called an action that gives me the number from database and I'm displaying in the small window. Now I'm stuck :(

P.S. : I'm using struts 1.x

3 Answers3

0

is the confirm method sufficient for you? it displays a notification and returns true if the user clicks ok.

var clickedOK = confirm('are you ok with the number: ' + yourNumber + ' ?');
if(clickedOK){
   //...

http://www.w3schools.com/js/js_popup.asp

actual_kangaroo
  • 5,971
  • 2
  • 31
  • 45
0

After click ok, then to populate the box with the value from db. let the value = "db_value";

<button >OK</button><input type="text" value="">

if(clickedOKButton){
     $(this).next().val(db_value) ;  // get the element selector(id) of box and put its value.
}
Riad
  • 3,822
  • 5
  • 28
  • 39
0

Thanks Riad for your time. :-) I have got the solution. implemented a javascript for the purpose.

opener.document.frm.number.value=db_value; // this passes db_value from the new       window to the source window

Cheers