470,594 Members | 1,558 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

updating combobox without refreshing in JSP page

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
13 7217
r035198x
13,262 8TB
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
202 Expert 100+
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
honey99
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
honey99
46
Thank u i'll try it with window.opener() ...
will anyone tell me the solution for my problem
Jul 26 '07 #5
sumittyagi
202 Expert 100+
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
honey99
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
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
honey99
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
5,821 Expert 4TB
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
honey99
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
5,821 Expert 4TB
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
honey99
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
5,821 Expert 4TB
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.

Similar topics

9 posts views Thread by Jervin Justin | last post: by
reply views Thread by lv2compute | last post: by
9 posts views Thread by paul | last post: by
2 posts views Thread by =?Utf-8?B?VmFuZXNzYQ==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.