javascript - Need To Call Struts Action Class Method Upon selecting radio button -
i need call struts action class method upon selecting 1 radio button (onclick event) using javascript. selection of radio button shall passed parameter action class method. how can achieve this? please me.
<s:form style="margin:5px 10;" action="searchaction" method="post" name="searchform"> <s:radio name="searchtype" label="criteria" list="{'data element','transaction details'}" requiredlabel="true" tooltip="your seach done depending upon selected criteria" onclick="func();"/>
<script language="javascript"> function func() { var b = document.getelementsbyname()('searchtype').value; var sub = document.searchform.action + '?searchtype=' + b; alert(sub); document.searchform.submit(); }
you can use javascript call achieve this...submit form javascript function value of selected radio.
function func() { var b = document.getelementsbyname()('searchtype').value; document.searchform.action = "searchaction?searchtype=" + b; document.searchform.submit(); }
Comments
Post a Comment