0

My Main JSP calls displayProjectLayout.jsp file which displays dropdown list.I need to fetch selected value from drop down but due to nested form in jsp's I am unable to get the select list value in mobilechangeProject action.I need to keep both the forms.

MY displayProjectLayout.jsp file: //common JSP

<script>
function submitProjectCode(){
    document.frm.action='/mobilechangeProject.action'; //calls action
    document.frm.submit();
}
</script>
<s:form  id="frm" theme="simple"> //2nd form
        <div class="shipAddress">
            <div class="shipbg">
                <label><s:text name="mobile.webshop.project.selection.label"/></label>
                <s:select list="{'Red', 'PO BOX 539', 'Green'}"
                onchange="javascript:submitProjectCode();" name="selectedProjectCode"  
                value="userContext.project.code" 
                cssStyle="width:100%; height:25px; padding: 0px!important; -webkit-appearance: menulist;" 
                theme="simple"/>
            </div>
            <s:if test="backURL != null" >
                <c:set var="url"><s:property value="backURL" /></c:set>
                <input type="hidden" name="currentUrl" value="${url}" />
            </s:if>
            <s:else>
                <input type="hidden" name="currentUrl" value="<%= request.getParameter("backAction")%>" />
            </s:else>
        </div>
        </s:form>
</s:if>

My Main JSP file: 

<s:form action="/mobileupdateBasket.action"  cssStyle="width:100%" id="basketFrm" name="basketFrm" theme="simple"> //1st form
//some other code

<c:if test="${empty param.displayProject || param.displayProject != false }">

                                                    <s:if test="isFileUsedForWebshop('/rexelmobile/xhtml/displayProjectLayout.jsp')">                                               

                                            </s:if> 


                                        </c:if>
</s:form>

//End

1 Answers1

0

I guess the main problem is that nested form is not allowed. See this thread: Can you nest html forms?

So, you can use Javascript as a workaround, but the point is: you need to separate your forms. If it is needed to send in the same action, get the values and set to your main hidden values for example. Hope it helps. ;)

Community
  • 1
  • 1
Laszlo Lugosi
  • 3,389
  • 1
  • 18
  • 17