drop down list problem

[nobr]in this code there is a dropdown list.. there is this one item that if you select it, the program goes nuts.. it returns to its home page.. my problem is I cant seem to find where it goes.. i have a hard time tracing it.. my question is if valueChangeListener="#adminController.selectListingLevel}" onchange="submit()"> has something to do with it.. and does the onchange mean it will submit the form?

thanks in advance!

-Arch-

html>

<head>

<title></title>

<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/pages.css"/>

<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/thatThing.js"></script>

<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/generalCheck.js"></script>

</head>

<body>

<%@ include file="header.jsp" %>

<h:form id="general" onsubmit="return check(this);">

<%@ include file="steps.jsp" %>

<br>

<h:outputText id="listingLevelId" value="#{addEditController.currentListingLevel.id}" style="color:white;"/>

<table border="0" cellpadding="3" cellspacing="0" width="100%">

<tr>

<td align="right" width="10%">Supplier Name:*</td>

<td width="30%"><h:inputText id="name" value="#{addEditController.supplier.name}" onfocus="changeBack(this)" maxlength="100"/></td>

<td><h:outputText value="Directory Listing Level" rendered="#{addEditController.adminMode}"/></td>

<td>

<h:panelGroup rendered="#{addEditController.adminMode}">

<h:selectOneMenu value="#{addEditController.supplier.listingLevelId}" valueChangeListener="#{adminController.selectListingLevel}" onchange="submit()">

<f:selectItems value="#{applicationRes.allDirectoryListingLevels}"/>

</h:selectOneMenu>

</h:panelGroup>

</td>

</tr>

<tr>

<td align="right" NOWRAP>Are you a head Office?:</td>

<td><h:selectBooleanCheckbox value="#{addEditController.supplier.headOffice}"/></td>

<td> </td>

<td> </td>

</tr>

<tr>

<td align="right">Address line 1:</td>

<td><h:inputText id="address1" value="#{addEditController.supplier.address1}" onfocus="changeBack(this);" maxlength="50"/></td>

<td align="right" width="10%" NOWRAP>Public Web Address:</td>

<td><h:outputText rendered="#{addEditController.currentListingLevel.id ==1}" value="Only Available to Subscribed Suppliers<br>" escape="false"/><h:inputText disabled="#{addEditController.currentListingLevel.id ==1}" value="#{addEditController.supplier.homePageUrl}" maxlength="60"/></td>

</tr>

<tr>

<td align="right">Address line 2:</td>

<td><h:inputText value="#{addEditController.supplier.address2}" maxlength="50"/></td>

<td align="right">e-mail:*</td>

<td><h:inputText id="email" value="#{addEditController.supplier.email}" onfocus="changeBack(this)" maxlength="50"/></td>

</tr>

<tr>

<td align="right">City or Town</td>

<td><h:inputText value="#{addEditController.supplier.city}" maxlength="40"/></td>

<td align="right">Phone:;</td>

<td><h:inputText value="#{addEditController.supplier.phone1}" maxlength="20"/></td>

</tr>

<tr>

<td align="right">State or District:</td>

<td><h:inputText value="#{addEditController.supplier.stateProvince}" maxlength="40"/></td>

<td align="right">After Hours Phone:</td>

<td><h:inputText value="#{addEditController.supplier.phone2}" maxlength="20"/></td>

</tr>

<tr>

<td align="right">Postal / Zip code:</td>

<td><h:inputText value="#{addEditController.supplier.zip}" maxlength="20"/></td>

<td align="right">Fax:</td>

<td><h:inputText value="#{addEditController.supplier.fax}" maxlength="20"/></td>

</tr>

<tr>

<td align="right">Country:*</td>

<td>

<h:selectOneMenu id="country" value="#{addEditController.supplier.countryCode}" styleClass="inputMedium" onfocus="changeBack(this)">

<f:selectItems value="#{applicationRes.allCountries}"/>

</h:selectOneMenu>

</td>

<td> </td>

<td> </td>

</tr>

<tr>

<td align="right">Description of Business:</td>

<td><h:outputText rendered="#{addEditController.currentListingLevel.id ==1}" value="Only Available to Subscribed Suppliers<br>" escape="false"/><h:inputTextarea id="description" disabled="#{addEditController.currentListingLevel.id ==1}" cols="50" rows="5" value="#{addEditController.supplier.description}" onclick="changeBack(this)"/></td>

<td align="right">Industry Association Memberships:</td>

<td>

<table width="20%" border="0" align="left">

<tr>

<td><img src="http://www.shipserv.com/ShipServ/images/Logo/impa-small.gif"/></td>

<td>IMPA</td>

<td><h:selectBooleanCheckbox value="#{addEditController.supplier.impaMember}"/></td>

</tr>

<tr>

<td><img src="http://www.shipserv.com/ShipServ/images/Logo/issa-small.gif"/></td>

<td>ISSA</td>

<td><h:selectBooleanCheckbox value="#{addEditController.supplier.issaMember}"/></td>

</tr>

</table>

</td>

</tr>

</table>

<%@ include file="stepsStepper.jsp" %>

</h:form>

</body>

</html>

</f:view>`

[/nobr]

[8834 byte] By [Arch_Bytesa] at [2007-11-26 21:50:16]
# 1

> and does the onchange mean it will submit the form?

The not specific the onchange itself, but the javascript "submit();" means that it will submit the form, indeed.

Also the other form values will be involved in submission.

I am not going to read and debug this big piece of code.

Please cut out all irrelevant parts of the code until you got the smallest possible working example which still reproduces the problem.

And maybe during the debugjourney you will solve the problem yourself ;)

One hint: add h:messages to the form to see if there will be a conversion or validation error thrown from JSF.

BalusCa at 2007-7-10 3:42:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

[nobr]<body>

<%@ include file="header.jsp" %>

<h:form id="general" onsubmit="return check(this);">

<%@ include file="steps.jsp" %>

<br>

<h:outputText id="listingLevelId" value="#{addEditController.currentListingLevel.id}" style="color:white;"/>

<table border="0" cellpadding="3" cellspacing="0" width="100%">

<tr>

<td align="right" width="10%">Supplier Name:*</td>

<td width="30%"><h:inputText id="name" value="#{addEditController.supplier.name}" onfocus="changeBack(this)" maxlength="100"/></td>

<td><h:outputText value="Directory Listing Level" rendered="#{addEditController.adminMode}"/></td>

<td>

<h:panelGroup rendered="#{addEditController.adminMode}">

<h:selectOneMenu value="#{addEditController.supplier.listingLevelId}" valueChangeListener="#{adminController.selectListingLevel}" onchange="submit()">

<f:selectItems value="#{applicationRes.allDirectoryListingLevels}"/>

</h:selectOneMenu>

</h:panelGroup>

</td>

</tr>

<tr>

ok well this is basically the part where im getting confused..^_^ basically when i select a different value from the drop down list a new page is called it just changes the labels

of most of the textfields.. but when i select the a certain item from the List(the last one) it goes back to the home page.. the original

author of this webpage Im debugging programed it that if an error occurs it will go back to its index.. it says that onchange it will call the submit method.. which calls

<h:form id="general" onsubmit="return check(this);">

check is a javascript function that simply checks whether the fields have been filled up correctly.. so if my tracing is correct im

assuming that it doesnt even get enter the javascript code since i place alerts there to check if was able to get to that part.. so if it doesnt go there, where does it go?.. ..i hate tracing..^_^ thanks..

Message was edited by:

Arch_Bytes[/nobr]

Arch_Bytesa at 2007-7-10 3:42:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
> the original author of this webpage Im debugging programed it that if an error > occurs it will go back to its indexDo you see the stacktrace of the exception in the systemout?Or is it just a JS (not JSF) error?
BalusCa at 2007-7-10 3:42:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

17:25:48,686 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet

threw exception

javax.faces.el.EvaluationException: Cannot get value for expression '#{addEditCo

ntroller.supplier.attachementsSize <1}'

im using JBOSS 4.0 as my application server.. i see the trace through the command shell.. this is the error given.. then it just continues and loads its index.html.. i know the line where the exception occurs but i dont know how it got there.. sorry im new to web app developement..^_^

Message was edited by:

Arch_Bytes

Arch_Bytesa at 2007-7-10 3:42:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
According to the errormessage the addEditController.getSupplier().getAttachementsSize() isn't available for the expression. Just add a debug breakpoint or a simple sysout to the getSupplier() and/or getAttachmentsSize() and see what happens.
BalusCa at 2007-7-10 3:42:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...