Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Related to Javascripet SELECT object  RSS feed

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have three select objects in one edit.jsp page. one for date anothers for month and year.
In display.jsp i am displaying date,month,year from database. in this page i have an option edit. if i click edit button the control goes to edit.jsp page.
there i want to display three select objects which contains values accordingly.
when i click edit button on display.jsp page, i want to display in edit.jsp ,the object of Date must display the date which is comes from display.jsp. month and year should display the values which are from display.jsp.
how to do that ? right now if i click the edit button, in edit.jsp page has displayed the date and month and year value starts from
01 JAN 2000.
any one knows solution pls let me know.

thanks
saran
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll explain the overall logic and syntax,
Let us assume that month value u need to set in the select list is stored in the jsp variable "dbMonth".
JSP Variable - dbMonth - Month value
HTML Form Name - frmForm - Form Name
HTML Form - selMonth - Month select list
so if above is the example case so for that im goin to explain you how to use javascript and to set the select list to the corresponding month.
the following code is assumed that the select list is populated with the date values.
<script>
for(i=0;i<document.frmForm.selMonth.length;i++)
{
if(document.frmForm.selMonth.options[i].value == '<%=dbMonth%>')
{
document.frmForm.selMonth.options[i].selected = true;
break;
}
}
</script>
like above you need to do for the select list to load with the value.
keep smiling
arun
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!