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
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!
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