binayakumar patel wrote:Are you sure there is multiple jsp is getting dynamically include to your one jsp file.
please check the code may be there is multiple <div> will be there . where while click on checkbox
it will make the <div> visiable...
If this is the case , if you are using multiple <div> and making it enable by clicking on check box then you can do it by javascript.
If this is not the scenario and you are calling the multiple jsp by <jsp:include> on click on checkbox... then javascript will not
help. You have to take a bean class and has to set the value in the jspbean and populate that bean value to the first jsp..
as when it will call first time there is no value in the bean,... when you click the second jsp you have to set the text value to the jspbean and has to call the same page....
while doing this ... the textfield in the first page will get the value from the jspbean .
Please note that keep the scope of the jspbean as session.
Eric Pascarello wrote:Do you know how to set a textbox value with JavaScript? Have you worked with the onchange event before?
Eric
Eric Pascarello wrote:so add an onchange event
It would be better to do it in an unobtrusive manner, but that is the basic idea.
Eric
Baji Roy wrote:
binayakumar patel wrote:Are you sure there is multiple jsp is getting dynamically include to your one jsp file.
please check the code may be there is multiple <div> will be there . where while click on checkbox
it will make the <div> visiable...
If this is the case , if you are using multiple <div> and making it enable by clicking on check box then you can do it by javascript.
If this is not the scenario and you are calling the multiple jsp by <jsp:include> on click on checkbox... then javascript will not
help. You have to take a bean class and has to set the value in the jspbean and populate that bean value to the first jsp..
as when it will call first time there is no value in the bean,... when you click the second jsp you have to set the text value to the jspbean and has to call the same page....
while doing this ... the textfield in the first page will get the value from the jspbean .
Please note that keep the scope of the jspbean as session.
Thank you for your inputs. Yes there is <div> in the forms. So it must be done through javascript.
Please do the needful.
Hi Patel,
I have done as below. But Its not populating the vaule in textbox.
In Y.jsp the code is like this.
var f1 = top.document.forms['tform'];
var f2 = top.document.forms['tform1'];
<input type=radio name=data value="data_res" onclick="javascript:getData();/>
on getData() method I have written the below code.
function getData() {
var rd = document.getElementsByName('data');
for(var i = 0; i < rd.length; i++) {
if(rd[i].checked) {
field = parent.document.createElement('INPUT');
field.value = rd[i].value;
document.forms[tform].data_back.value = rd[i].value; // Here data_back is the name of the textbox for form name tform which is the upper form already displayed
(X.jsp)
}
}
f2.submit();
}
The above code is not replacing the selected the text value into the upper form textbox location. Please let me know whether I am missing something.
Baji Roy.
Don't get me started about those stupid light bulbs. |