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     [CLOSED] Error parsing textarea

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Error parsing textarea
 Login/Join
 
Gold member
posted
I have a drop-down list with 3 values, based on these values, different textareas are shows. I'm getting an error when trying to parse the values. Unable to set property 'value' of undefined or null reference. on inputList.value= '';

This worked in earlier version but not 8.0.08. Here is the relevant JS:

 //Begin function cleanArray
function cleanArray(originalArray){
	var newArray = new Array(); 
	for(var i = 0; i < originalArray.length; i++){
		if(originalArray[i] != ""){
			newArray.push(originalArray[i]); 
		}
	}
	return newArray; 
}
//End function cleanArray
 
 
 
 
//Begin function parseList
function parseList(textArea){
	var textAreaControl = document.getElementById(textArea); 
	var itemArray = textAreaControl.value.split("\n"); 
	var whichInput = ""; 
	switch(textArea){
		case "top_assoc_area":
			whichInput = "top_assoc_list";
			break; 
		case "client_group_area": 
			whichInput = "client_group_list"; 
			break; 
		case "chain_area":
			whichInput = "chain_list"; 
			break; 
		case "mid_list_area":
			whichInput = "mid_list";
			break; 
	}
 
	var finalArray = cleanArray(itemArray); 
 
	var inputList = document.getElementById(whichInput); 	
	inputList.value = ""; 
 
	for(var i = 0; i < finalArray.length; i++){	
		//if(i = 0){
		//	inputList.value = ' "' + finalArray[i] + '" '; 
		//}else{	
		//	inputList.value = inputList.value + 'OR "' + finalArray[i] + '" '; 
		//}	
		if(inputList.value == ""){
			inputList.value = "" + finalArray[i].trim() + "";
		}else {
			inputList.value = inputList.value + "," + finalArray[i].trim() + "";
		}
	}
}
//End function parseList 

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.0.08
Solaris
HTML, PDF, XLS, CSV
 
Posts: 55 | Registered: September 08, 2010Report This Post
Guru
posted Hide Post
Hi Suzy,

When you say that your JavaScript worked in earlier versions can you please indicate which version.

What browser are you using? Here is the link to the supported browsers - Web Browser Support for WebFOCUS

Thank you for participating in the Focal Point Forum.

Kindest regards,
Tamra Colangelo
Focal Point Moderator
Information Builders Inc.


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Report This Post
Master
posted Hide Post
This looks more like a javascript issue instead of a webfocus issue. How are you passing text area into the gunction? Can you post that piece of code? Or the whole html? I would try putting an alert into the function to make sure you are getting a value passed for text area in the first place.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Silver Member
posted Hide Post
Hi Susan

Reference the Textarea with the following code:

alert(IbComposer_getCurrentSelection('textarea1'));


IbComposer_setCurrentSelection('textarea1','New message', false);

That will probably work better for you.

Thanks Barry


WebFOCUS 8
Windows, All Outputs
 
Posts: 34 | Registered: September 08, 2015Report This Post
Master
posted Hide Post
Susan, its because your switch(textArea), doesn't have a DEFAULT.. Something is being passed in, that doesn't follow your four CASEs.

Add an alert(textArea) right before the switch. See what is being passed.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report This Post
Member
posted Hide Post
Hi Suzy,

In chrome press F12 to bring up developer tools, click on the console tab, refresh the procedure and hit the submit button in your procedure. Everything in the console.log(); will be output to the console tab so you can verify your code including parameters ans objects. You are able to add breakpoints in your script and then hover over the parameters to see what values they are.

All nice debugging techniques.

Hopefully below assists you.

 
-HTMLFORM BEGIN
<!DOCTYPE html>
<html lang="en">
<head>
  <script>
//Begin function cleanArray
function cleanArray(originalArray){
	var newArray = new Array(); 
	for(var i = 0; i < originalArray.length; i++){
		if(originalArray[i] != ""){
			newArray.push(originalArray[i]); 
		}
	}
	return newArray; 
}
//End function cleanArray

 
//Begin function parseList
function parseList(textArea){
-*	var textAreaControl = document.getElementById(textArea); 
-*	var itemArray = textAreaControl.value.split("\n"); 

	var textAreaText = document.getElementById(textArea).value;
	console.log('Output for textAreaText: ' + textAreaText);

	var itemArray = textAreaText.split("\n"); 
	console.log('Output for itemArray: ' + itemArray);

	var whichInput = ""; 
-*	switch(textArea){
	switch(textAreaText){
		case "top_assoc_area":
			whichInput = "top_assoc_list";
			break; 
		case "client_group_area": 
			whichInput = "client_group_list"; 
			break; 
		case "chain_area":
			whichInput = "chain_list"; 
			break; 
		case "mid_list_area":
			whichInput = "mid_list";
			break; 
	}

	var finalArray = cleanArray(itemArray); 
	console.log('Output for finalArray: ' + finalArray);
  
}
//End function parseList 
  </script>
 </head>
 <body>
    <textarea id="myTextArea">
1
2
3
4
    </textarea>
    <input type="button" onClick="parseList('myTextArea');" value="submit">
 </body>
 </html>
 -HTMLFORM END


WF 8.1.05, MRE, BI Portal, App Studio, Apache Tomcat/8.0.21, MS Windows Server 2014 Express, MS Windows 10, Chrome
 
Posts: 11 | Registered: September 18, 2015Report 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     [CLOSED] Error parsing textarea

Copyright © 1996-2020 Information Builders