• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to populate dependent <html:select >

 
Bushra Binte
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,I am using netbeans6.5 with struts1.2.9 framework.In a jsp page when the user selects a value from the list,based on that value next <html:select> tag options has to be populated from the server.For this i am extending myaction class to dispatchAction.I have also added the method to be invoked when the user selects a value from the first select <html:select> LOV(list of values).

Now the problem is i have added a javascript function getSecondListOfValues() for an onchange event of the first select tag like this


<html:form action="/Search.do" method="POST">

<html:select property="firstSelect" onchange="getSecondListOfValues()">
<htmlptionsCollections ....>/<html;optionsCollections>
</html:select>

<html:select property="secondSelect" onchange="getThirdListOfValues()">
<htmlptionsCollections ....>/<html;optionsCollections>
</html:select>

<html:select property="thirdSelect" >
<htmlptionsCollections ....>/<html;optionsCollections>
</html:select>

<html:submit value="Submit"></html:submit>

</html:form>

In javascript function:

function getSecondListOfValues()
{

var firstSelectedValue = document.getElementById("firstSelect");

document.myform.action.value="SearchAction"; // This is the action name that extends DispatchAction class
document.myform.method.value="getSecondList"; // This is the method in SearchAction class

return true;
}

struts-config.xml:

<action name="searchFormBean"
path="/Search"
parameter="method"
type="com.training.reps.action.SearchAction">
<forward name="success" path="/SearchOrders.jsp"/>
</action>


The error:

I get javascript error saying myform is null or not an object.

I understand that i have not specified the form name in <html:form> tag as struts-html.tld doesnt let to specify and gets an error "name attribute is not declared in struts-html.tld".


 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is this related to JSF?
 
Bushra Binte
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i havent noticed that.and i need a solution for it urgently.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Butool Begum wrote:i havent noticed that.

Please carefully choose forum before posting. Depending on the root cause of the problem, you should use the Struts or the Javascript forum. Here at the JSF forum you have much less chance to meet Struts or Javascript experts.

and i need a solution for it urgently.

Please be careful with what you say. Those words are likely to scare others and you would likely get ignored. Urgency is your problem, not ours. Moving your pressure to our side is very rude. Just be kind and have patience.
 
Bushra Binte
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i already said that i did not notice the forum.i dint mean that.but that is what is spelled out there, i am sorry about it.And yeah i do have patience..thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!