Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in getting the values from combo box when values includes space

 
suganya vijaykumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi .. i tried to getting the values from combo box and passed to next jsp file.. i got the result when i'm selecting the item which in one word.. for example i'm getting "Agent" value form combo.. but if it is "Whole Sale" i'm getting the word "whole" only in the next page.. i attached the coding
function validation()
{
var cbo=document.getElementById("cid");
var val=cbo.options[cbo.selectedIndex].value;
document.custdetails.hidctype.value=val;
document.custdetails.method="post";
document.custdetails.action="custtype.jsp";
document.custdetails.submit();
}


<select name="ctype" id="cid" style="width:100px" >
<OPTION>--SELECT-- </OPTION>
<%try
{
connect =new databaseConnectivity.databaseConnection();
ResultSet rs=null;
String qry="select customertype from custtype order by customertype";
rs=connect.selectQuery(qry);
while(rs.next())
{
String cust=rs.getString(1);
%>
<option value=<%=cust%>><%=cust%></option>
<%
}
}
catch(Exception e)
{}
%>
</select>
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly you need to know that HtmlHasNoComboBox. Using the term combobox creates confusions.
I think this a problem of URL encoding. You need to encode your request URL so that white space is handled properly.


Hope this helps
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the HTML that your code is generating? If you do, you will see that the HTML is badly formed and is the cause of your issue.

And yeah, it's not a "combo box". Please use correct terminology.
[ September 18, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!