• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic