Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Calling FOCUS/Javascript

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Calling FOCUS/Javascript
 Login/Join
 
Member
posted
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:



CVASalesReporting




<script language="javascript">

function valForm() {

//var selected_report = document.Form1.document.getElementsByName("ucWUC1:RPTSEL_LBOX");
//getElementsByTagName('ucWUC1:RPTSEL_LBOX');

//var selected_report = window.Form1.document.getElementsByName("ucWUC1:RPTSEL_LBOX");

window.alert ("This is a Javascript Alert")

//if (selected_report != "TERRSALES") {
//window.alert (selected_report)
//window.alert ("Invalid report combination.")
//return false;
//}
//else return true;
}

//alert(document.Form1.getElementsByTagName.toString("ucWUC1:RPTSEL_LBOX"));
//alert(pagesObj.options[pagesObj.selectedIndex].value);
//}


function submitForm()
{
var strAction = document.Form1.action;
var strViewState = document.Form1.__VIEWSTATE.value;
document.Form1.target="_new";
// document.Form1.action="http://citms042.arvinmeritor.com/ibi_apps/WFServlet"
document.Form1.__VIEWSTATE.value="";
// document.Form1.submit();

document.Form1.onclick="javascript:valForm()"
//document.Form1.submit(onClick="valForm()")

document.Form1.target="";
document.Form1.action=strAction;
document.Form1.__VIEWSTATE.value=strViewState;
}





 













 
Posts: 9 | Registered: October 24, 2006Report This Post
Expert
posted Hide Post
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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Master
posted Hide Post
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

 
Posts: 865 | Registered: May 24, 2004Report This Post
Silver Member
posted Hide Post
‘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
 
Posts: 35 | Location: Oklahoma City | Registered: May 11, 2006Report This Post
Member
posted Hide Post
Here's the solution:
<%@ Register TagPrefix="uc1" TagName="CVAWebUserControl3" Src="usercontrols/CVAWebUserControl3.ascx" %>
<%@ Register TagPrefix="uc1" TagName="CVAWebUserControl1" Src="usercontrols/CVAWebUserControl1.ascx" %>
<%@ Register TagPrefix="uc1" TagName="CVAWebUserControl2" Src="usercontrols/CVAWebUserControl2.ascx" %>
<%@ Page language="c#" Codebehind="CVASalesReporting.aspx.cs" AutoEventWireup="false" Inherits="CVASalesReporting.web.CVASalesReporting" %>
< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
	<title>CVASalesReporting</title>
	<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
	<meta content="C#" name="CODE_LANGUAGE">
	<meta content="java_script" name="vs_defaultClientScript">
	<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
	<script language="javascript">
		
function valForm() {

var selected_report = document.getElementById("ucWUC1:RPTSEL_LBOX").value;

var selected_mkt_report = document.getElementById("ucWUC1:MKTP_LBOX").value;

if (selected_report == "TERRSALES" && selected_mkt_report != "All Marketing Programs")
{
window.alert ("Invalid report combination.")
return false
}
else if (selected_report == "STSALES" && selected_mkt_report != "All Marketing Programs") 
{
window.alert ("Invalid report combination.")
return false
}
else if (selected_report == "REBATE" && selected_mkt_report != "All Marketing Programs") 
{
window.alert ("Invalid report combination.")
return false
}
else if (selected_report == "CVAMIXVL" && selected_mkt_report != "All Marketing Programs") 
{
window.alert ("Invalid report combination.")
return false
}
else if (selected_report == "CVAMVYTD" && selected_mkt_report != "All Marketing Programs") 
{
window.alert ("Invalid report combination.")
return false
}
else return true;
}

	
function submitForm()
  {  
	var strAction = document.Form1.action;
	var strViewState = document.Form1.__VIEWSTATE.value;
         document.Form1.target="_new";
         document.Form1.action="http://citmsxxx.xxxxxxx.com/ibi_apps/WFServlet"
	document.Form1.__VIEWSTATE.value="";
	document.Form1.submit();

		document.Form1.target="";
		document.Form1.action=strAction;
		document.Form1.__VIEWSTATE.value=strViewState;
	  }
		</SCRIPT>
	</HEAD>
	<body bgColor="#cccccc" ms_positioning="GridLayout">
	<form id="Form1" method="post" onSubmit="return valForm[this)" runat="server">
	 
	<table cellSpacing="0" cellPadding="5" border="1">
	<tr>
	<td><uc1:cvawebusercontrol1 id="ucWUC1" runat="server" OnCommand="ucWUC1_Command"></uc1:cvawebusercontrol1></td>
	</tr>
	<tr>
	<td><uc1:cvawebusercontrol2 id="ucWUC2" runat="server" OnCommand="ucWUC2_Command"></uc1:cvawebusercontrol2></td>
	</tr>
	<tr>
	<td><uc1:cvawebusercontrol3 id="ucWUC3" runat="server" OnCommand="ucWUC3_Command"></uc1:cvawebusercontrol3></td>
	</tr>
	</table>
	<asp:literal id="ljava_script" Runat="server"></asp:literal></form>
	</body>
</HTML>

This message has been edited. Last edited by: Kerry,
 
Posts: 9 | Registered: October 24, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Calling FOCUS/Javascript

Copyright © 1996-2020 Information Builders