Thursday, 3 April 2014

send data with ,(cama's)

 public String method()throws Exception
{


StringBuffer sb = new StringBuffer(40);
StringBuffer sb1 = new StringBuffer(40);

   
String[] fromcls=request.getParameterValues("fromcls");
for(int i=0;i<fromcls.length;i++)
{
sb.append(fromcls[i]);
System.out.println("fromcls is : "+fromcls[i]);
}

System.out.println("sb is : "+sb);
String[] getsec=request.getParameterValues("getsec");
if(getsec.length==0){
System.out.println("if statement ");
    sb1.append("All");
    }
else{
for(int i=0;i<getsec.length;i++)
{
sb1.append(getsec[i]).append(",");
System.out.println("section is : "+getsec[i]);
}
}
System.out.println("sb1 is : "+sb1);

   
    String msg=Adao.acceptStatus(iid,year,sid,designName,reason,type,sb1,sb,grup);
   
 
return "methodurl";
}

Wednesday, 2 April 2014

How to send multiple selected values in select box to script

<!DOCTYPE html>
<html>
<head>
<script>
function show()
{
     var InvForm = document.forms.form;
     var SelBranchVal = "";
     var x = 0;
     for (x=0;x<InvForm.kb.length;x++)
         {
            if(InvForm.kb[x].selected)
            {
             //alert(InvForm.kb[x].value);
             SelBranchVal = InvForm.kb[x].value + "," + SelBranchVal ;
            }
         }
         alert(SelBranchVal);
}
</script>
</head>
<body>
<form name="form">
<select name="kb" id="kb" onclick="show();" multiple>
<option value="India">India</option>
<option selected="selected" value="US">US</option>
<option value="UK">UK</option>
<option value="Japan">Japan</option>
</select>
<!--input type="submit" name="cmdShow" value="Customize Fields"
 onclick="show();" id="cmdShow" /-->
</form>
</body>
</html>