I have a .NET/WebFOCUS reporting application. I have an up-front asp page. On the asp page a user can select from many drop-down boxes. However, some combinations of reports and drop-down boxes are not allowed. I need to incorporate some javascript in the asp page to check for these invalid combinations. I can't seem to get the javascript to work, even the simple alert will not display. Any ideas?
Here's the snipet of the html code from the asp page:
This is a WebFOCUS forum. ASP is not something we do often. Have you tried an ASP forum? This site might help: http://aspjavascript.com/
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 06, 2006, 09:39 AM
TexasStingray
I am assuming that you have a link that call the submitForm java script function. In the submitForm function at the top add an alert to make sure it is being called.
function submitForm()
{
alert("Start submitForm...");
}
see if that works. then if it does call valForm like so.
function submitForm()
{
alert("Start submitForm...");
valForm();
}
Hope this helps
Scott
December 06, 2006, 10:06 AM
ok_dhs
‘form’ is a section of a document. It is like a tree. Starts from navigator -> window -> document -> form and so on. We can not have document as pasrt of form itself. Here is what you have in you code.
var selected_report = document.Form1.document.getElementsByName("ucWUC1:RPTSEL_LBOX");
You can either use (because you are passing this form as value)
var selected_report = Form1.ucWUC1:RPTSEL_LBOX.value;
OR
I would try changing it to:
var selected_report = document.getElementsByName("ucWUC1:RPTSEL_LBOX");
Here is an example
<html>
<head>
<title>JavaScript Validation</title>
<script type="text/javascript">
function valForm() {
var selected_report = document.getElementsByName("ucWUC1:RPTSEL_LBOX");
window.alert ("This is a Javascript Alert")
// OR the following message
if (!(selected_report == "TERRSALES")) {//Provided ucWUC1:RPTSEL_LBOX is passing this value
window.alert (selected_report + "is an invalid report combination.")
return false;
}
return true;
}
//alert(document.Form1.getElementsByTagName.toString("ucWUC1:RPTSEL_LBOX"));
//alert(pagesObj.options[pagesObj.selectedIndex].value);
//}
</script>
</head>
<body bgcolor="#ffffff">
<form name="Form1" action='/ibi_apps/WFServlet' method='post' onSubmit="return valForm[this);">
<h2 align="center">Please Enter Your Details Below</h2>
Report Name: <input type="text" name="ucWUC1:RPTSEL_LBOX"></p>
<input type="submit" name="send" value="Send Details"></p>
</form>
</body>
</html>
This message has been edited. Last edited by: ok_dhs,
Prod: WebFOCUS 7.1.3 on Linux Kernel-2.6.5 zSeries 64bit/Apache Tomcat/5.0.28 JAVA version 1.4.2_11 server