Skip to Content
author's profile photo Former Member
Former Member

client side validations on document having multiple forms & external jsp

Hi,

Due to the long jsp page(limitations of Verify Error, loading time) , I have made 3 jsp files and included them in main jsp page using jsp action tags(dynamic/external jsp).

Main jsp page contains.

<jsp:include page="incECHeaderExt.jsp" flush="true" />

<jsp:include page="incTabsExt.jsp" flush="true" />

<jsp:include page="incPartItemsExt.jsp" flush="true" />

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

Each jsp page is having its own form and controls.

Now in main page if user clicks a button (in incFooter.jsp), i need to validate input fields/dropdows,check boxes in the above three external files before calling server method.

Pl provide some sample code how can i access/call elements

of these external file forms to validate.

Thanks

Markandeya

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 14, 2004 at 03:18 PM

    For this you must use javascript.

    Here I give you an example:

    4 JSPs: otro.jsp, otro1.jsp, otro2.jsp, otro3.jsp

    • otro.jsp code:

    <html>

    <body>

    <center>Method getRemoteAddr sais: <%= request.getRemoteAddr() %><br></center>

    <jsp:include page="otro1.jsp" flush="true" />

    <jsp:include page="otro2.jsp" flush="true" />

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

    </body>

    </html>

    • otro1.jsp code:

    <form name="otro1" method="post" action="tal">

    <input type="text" name="text1" size="30">

    </form>

    • otro2.jsp code:

    <form name="otro2" method="post" action="tal">

    <input type="text" name="text2" size="30">

    </form>

    • otro3.jsp code:

    <script language="JavaScript1.2">

    <!--

    function hasClicked(){

    var formularios = document.forms;

    for(i=0;i<formularios.length;i++){

    formularios<i>.elements[0].value="Someone has clicked the button!!!";

    //Note: elements[0] represents the first <input> element

    // or others elements in the form like <textarea>

    // <select> ...

    }

    }

    -->

    </script>

    <form name="otro3" method="post" action="tal">

    <input type="text" name="text3" size="30"><br>

    <input type="button" value="myButton" onClick="hasClicked()">

    </form>

    So the code in navigator is text/html, then you could access each form as they were on the same page.

    Regards!

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks

      But all of the files use the htmlb forms with htmlb controls. Also pl tell me how to go about the controls of the each page in the JspDynpage.

      inputFld = (InputField) getComponentByName("input_EndOperatorValue"); is giving null

      Thanks

      Markandeya

  • author's profile photo Former Member
    Former Member
    Posted on May 15, 2004 at 08:57 AM

    Hi

    I´ve had a similiar problem. Take a look at "Javascript Example isn´t working"

    SAP Enterprise Portal : Administration and Development

    Perhaps this helps you to access all htmlb elements

    Alexander

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.