• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

populating jsp fields through javascript

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I want to set value of hidden field in jsp through java script. I have array of checkbox in my jps and I want to store the value of check box in hidden field by passing the index value to javascript..

Javascript code
function check(index, propertyname, newvalue)
document.getElementById('clossProcess['+index+'].'+propertyName).value= newvalue;
}

function changeFlag(index, closeCheckBox){
var flag="no";
if (closeCheckBox)="true"{
flag="yes";
check(index,'closeFlag',false);
}

Jsp

........
"<"logic:iterate id="closeProcess name=formname property="statusList">"
<html:hidden indexed="true" name=closeprocess property=closeFlag value="no"/">"
"<"/logic:iterate

I have array of checkboxes
property name is closeFlag when i check on it will call the javascript changeFlag( '${index)$', this) and that internally will call check(index,propertyname,newvalue)
I want to set the value of checkbox in the hiddenfield.

Thanks in advance
Infynity
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like you are mixing up what happens on the client side with Javascript with what happens on the server side to write the HTML page to the client.
You do NOT have a "hidden field in jsp" - JSP can write an HTML form that has a hidden field. (Or to be even more picky, JSP can create a servlet that can write an HTML form.)
When I have to develop a page that has Javascript, I do it with a static page of HTML + Javascript first. Using Firefox or other browser-side debugging capability to make sure the Javascript runs right. ONLY then do I try to write the sevlet or JSP that will create such a page dynamically.
Bill
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic