By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

updating combobox without refreshing in JSP page

P: 46
Hi!
I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters the combobox...but the data in the combobox of parent window(Ex1.jsp) is entering only when i refresh the parent(Ex1.jsp) page...so how data can be entered in both comboboxes without refreshing???
Jul 26 '07 #1
Share this Question
Share on Google+
13 Replies


10K+
P: 13,264
Hi!
I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters the combobox...but the data in the combobox of parent window(Ex1.jsp) is entering only when i refresh the parent(Ex1.jsp) page...so how data can be entered in both comboboxes without refreshing???
I don't understand all that you're saying here, but I suspect a Javascript expert may be able to say a few words on the matter, so I'll copy this there as well.
Jul 26 '07 #2

sumittyagi
Expert 100+
P: 202
Hi!
I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters the combobox...but the data in the combobox of parent window(Ex1.jsp) is entering only when i refresh the parent(Ex1.jsp) page...so how data can be entered in both comboboxes without refreshing???
you can have a reference of the parent window by window.opener() method.
Once you have the parent window reference, you can add options to the select box by simple javascript.
Jul 26 '07 #3

P: 46
you can have a reference of the parent window by window.opener() method.
Once you have the parent window reference, you can add options to the select box by simple javascript.
Thank u i'll try it with window.opener() ...
Jul 26 '07 #4

P: 46
Thank u i'll try it with window.opener() ...
will anyone tell me the solution for my problem
Jul 26 '07 #5

sumittyagi
Expert 100+
P: 202
will anyone tell me the solution for my problem
have you tried window.opener().

If yes then paste your code here, we will see what's wrong with that.
If no then no-body on any forum on this site like spoon-feeders.
Jul 26 '07 #6

P: 46
have you tried window.opener().

If yes then paste your code here, we will see what's wrong with that.
If no then no-body on any forum on this site like spoon-feeders.
Thanks for u r reply..
i'm posting me code here...plz go through the code and tell me a solution

Ex1.jsp

<a href="Ex.Action" target="_blank" onclick="window.open(this.href,'newwindow','width= 700,height=500,scrollbars=yes');return false;">click here</a>

<td class="flabel" width="240" nowrap>

Select.draw(out, mod.getConnectString(),"cmb","Style", "Width:130px", -1, true, " onfocus='javascript:fcolor(this)'; onblur='javascript:bcolor(this)' onchange='javascript:textChange(this);' ",some SQL query;",new String[]{"id"},new String[]{"value"}, model.get() , some SQL query);

Ex2.jsp

<td colspan=3 align='left' nowrap class="formdata">
<select name=chr_txtselect style='width=300px;' onChange="javascript:changecombo(this);">

How can i update both comboboxes without refreshing in both the JSP pages i.e.if i enter data in Ex2.jsp,it should enter in combobox of Ex1.jsp also without refreshing???how can i get this??any solution......................
Jul 27 '07 #7

P: 4
Thanks for u r reply..
i'm posting me code here...plz go through the code and tell me a solution

Ex1.jsp

<a href="Ex.Action" target="_blank" onclick="window.open(this.href,'newwindow','width= 700,height=500,scrollbars=yes');return false;">click here</a>

<td class="flabel" width="240" nowrap>

Select.draw(out, mod.getConnectString(),"cmb","Style", "Width:130px", -1, true, " onfocus='javascript:fcolor(this)'; onblur='javascript:bcolor(this)' onchange='javascript:textChange(this);' ",some SQL query;",new String[]{"id"},new String[]{"value"}, model.get() , some SQL query);

Ex2.jsp

<td colspan=3 align='left' nowrap class="formdata">
<select name=chr_txtselect style='width=300px;' onChange="javascript:changecombo(this);">

How can i update both comboboxes without refreshing in both the JSP pages i.e.if i enter data in Ex2.jsp,it should enter in combobox of Ex1.jsp also without refreshing???how can i get this??any solution......................
Hi,

You can do this thing using AJAX.
try to implement this.
Jul 27 '07 #8

P: 46
Hi!
I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters the combobox...but the data in the combobox of parent window(Ex1.jsp) is entering only when i refresh the parent(Ex1.jsp) page...so how data can be entered in both comboboxes without refreshing???

--------------------------------------------------------------------------------

i'm posting me code here...plz go through the code and tell me a solution

Ex1.jsp
Expand|Select|Wrap|Line Numbers
  1. <a href="Ex.Action" target="_blank" onclick="window.open(this.href,'newwindow','width=700,heigh t=500,scrollbars=yes');return false;">click here</a>
  2.  
  3. <td class="flabel" width="240" nowrap>
  4.  
  5. Select.draw(out, mod.getConnectString(),"cmb","Style", "Width:130px", -1, true, " onfocus='javascript:fcolor(this)'; onblur='javascript:bcolor(this)' onchange='javascript:textChange(this);' ",some SQL query;",new String[]{"id"},new String[]{"value"}, model.get() , some SQL query);
  6.  
Ex2.jsp
Expand|Select|Wrap|Line Numbers
  1. <td colspan=3 align='left' nowrap class="formdata">
  2. <select name=chr_txtselect style='width=300px;' onChange="javascript:changecombo(this);">
  3.  
How can i update both comboboxes without refreshing in both the JSP pages i.e.if i enter data in Ex2.jsp,it should enter in combobox of Ex1.jsp also without refreshing???how can i get this??any solution......................

can anyone tell how to solve this problem through AJAX????????
Jul 27 '07 #9

pbmods
Expert 5K+
P: 5,821
Heya, honey99.

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Jul 27 '07 #10

P: 46
Heya, honey99.

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Expand|Select|Wrap|Line Numbers
  1. Ex1.jsp
  2.  
  3. Code: ( html4strict )
  4. <a href="Ex.Action" target="_blank" onclick="window.open(this.href,'newwindow','width=700,heigh   t=500,scrollbars=yes');return false;">click here</a>
  5.  
  6. <td class="flabel" width="240" nowrap>
  7.  
  8. Select.draw(out, mod.getConnectString(),"cmb","Style", "Width:130px", -1, true, " onfocus='javascript:fcolor(this)'; onblur='javascript:bcolor(this)' onchange='javascript:textChange(this);' ",some SQL query;",new String[]{"id"},new String[]{"value"}, model.get() , some SQL query);
  9.  
  10. Ex2.jsp
  11.  
  12. Code: ( html4strict )
  13. <td colspan=3 align='left' nowrap class="formdata">
  14. <select name=chr_txtselect style='width=300px;' onChange="javascript:changecombo(this);">
  15.  
how i can update comboboxes in both JSP pages without refreshing
Jul 28 '07 #11

pbmods
Expert 5K+
P: 5,821
Heya, honey99.

Probably the best way to accomplish this would be to set up an AJAX call to a JSP page that outputs a JSON-encoded object containing the new options for the SELECT element.

From there, your JavaScript could eval() the returned object, then dynamically create OPTION elements on the fly.
Jul 28 '07 #12

P: 46
Heya, honey99.

Probably the best way to accomplish this would be to set up an AJAX call to a JSP page that outputs a JSON-encoded object containing the new options for the SELECT element.

From there, your JavaScript could eval() the returned object, then dynamically create OPTION elements on the fly.
Thank u i'll try with this...
Jul 28 '07 #13

pbmods
Expert 5K+
P: 5,821
Good luck with your project! If you run into any trouble, post back, and we'll help you get it sorted out!
Jul 28 '07 #14

Post your reply

Sign in to post your reply or Sign up for a free account.