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] Text Box automatically filled

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Text Box automatically filled
 Login/Join
 
Platinum Member
posted
Hello,
I want to fill a text box automatically depending on the input from another text box. For example in the first text box the user types a company number and after the sixth
digit the company name prompted automatically in the second text box.

Christian

This message has been edited. Last edited by: Kerry,


WF Production Version: 7.7.02M
WF Test Version: 7.7.02M
Developer Studio: 7.7.02
HTML, EXL2K, FLEX, PDF,PPT
 
Posts: 156 | Location: Essen Germany | Registered: December 02, 2010Report This Post
Gold member
posted Hide Post
You mean something like this??

-HTMLFORM BEGIN


Autocomplete Test

<script type="text/javascript">
< !--
var suggestions = new Array("WebFocus", "Business Object", "SAP", "MicroStrategy","Microsoft Reporting Service");
var outp;
var oldins;
var posi = -1;
var words = new Array();
var input;
var key;

function setVisible(visi){
var x = document.getElementById("shadow");
var t = document.getElementsByName("text")[0];
x.style.position = 'absolute';
x.style.top = (findPosY(t)+3)+"px";
x.style.left = (findPosX(t)+2)+"px";
x.style.visibility = visi;
}

function init(){
outp = document.getElementById("output");
window.setInterval("lookAt()", 100);
setVisible("hidden");
document.onkeydown = keygetter; //needed for Opera...
document.onkeyup = keyHandler;
}

function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent){
while (obj.offsetParent){
curleft += obj.offsetLeft;
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent){
curtop += obj.offsetHeight;
while (obj.offsetParent){
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
}
else if (obj.y){
curtop += obj.y;
curtop += obj.height;
}
return curtop;
}

function lookAt(){
var ins = document.getElementsByName("text")[0].value;
if (oldins == ins) return;
else if (posi > -1);
else if (ins.length > 0){
words = getWord(ins);
if (words.length > 0){
clearOutput();
for (var i=0;i < words.length; ++i) addWord [words[i]);
setVisible("visible");
input = document.getElementsByName("text")[0].value;
}
else{
setVisible("hidden");
posi = -1;
}
}
else{
setVisible("hidden");
posi = -1;
}
oldins = ins;
}

function addWord(word){
var sp = document.createElement("div");
sp.appendChild(document.createTextNode(word));
sp.onmouseover = mouseHandler;
sp.onmouseout = mouseHandlerOut;
sp.onclick = mouseClick;
outp.appendChild(sp);
}

function clearOutput(){
while (outp.hasChildNodes()){
noten=outp.firstChild;
outp.removeChild(noten);
}
posi = -1;
}

function getWord(beginning){
var words = new Array();
for (var i=0;i < suggestions.length; ++i){
var j = -1;
var correct = 1;
while (correct == 1 && ++j < beginning.length){
if (suggestions[i].charAt(j) != beginning.charAt(j)) correct = 0;
}
if (correct == 1) words[words.length] = suggestions[i];
}
return words;
}

function setColor (_posi, _color, _forg){
outp.childNodes[_posi].style.background = _color;
outp.childNodes[_posi].style.color = _forg;
}

function keygetter(event){
if (!event && window.event) event = window.event;
if (event) key = event.keyCode;
else key = event.which;
}

function keyHandler(event){
if (document.getElementById("shadow").style.visibility == "visible"){
var textfield = document.getElementsByName("text")[0];
if (key == 40){ //Key down
//alert (words);
if (words.length > 0 && posi if (posi >=0) setColor(posi, "#fff", "black");
else input = textfield.value;
setColor(++posi, "blue", "white");
textfield.value = outp.childNodes[posi].firstChild.nodeValue;
}
}
else if (key == 38){ //Key up
if (words.length > 0 && posi >= 0){
if (posi >=1){
setColor(posi, "#fff", "black");
setColor(--posi, "blue", "white");
textfield.value = outp.childNodes[posi].firstChild.nodeValue;
}
else{
setColor(posi, "#fff", "black");
textfield.value = input;
textfield.focus();
posi--;
}
}
}
else if (key == 27){ // Esc
textfield.value = input;
setVisible("hidden");
posi = -1;
oldins = input;
}
else if (key == 8){ // Backspace
posi = -1;
oldins=-1;
}
}
}

var mouseHandler=function(){
for (var i=0; i < words.length; ++i)
setColor (i, "white", "black");

this.style.background = "blue";
this.style.color= "white";
}

var mouseHandlerOut=function(){
this.style.background = "white";
this.style.color= "black";
}

var mouseClick=function(){
document.getElementsByName("text")[0].value = this.firstChild.nodeValue;
setVisible("hidden");
posi = -1;
oldins = this.firstChild.nodeValue;
}
//-->

This message has been edited. Last edited by: WFLurker,


WF 8105M
- Portal, Dashboard
- Rcaster, Data Migrator
- Windows 2012 Client Server
- Dev/App Studio 8105
- Data: SQL, Oracle, Neteeza,MVS
 
Posts: 78 | Registered: October 24, 2006Report This Post
Platinum Member
posted Hide Post
Hello WFLurker,
thanks a lot. i will check this tomorrow. How can i combine the code with a webfocus datasource. the company names and id are in a webfocus datasource in this case a sql server 2005 table. in my project i have to build a form in which sales-people colect their contracts and the amount of savings. Later i have to build a report on this savings!!

Christian


WF Production Version: 7.7.02M
WF Test Version: 7.7.02M
Developer Studio: 7.7.02
HTML, EXL2K, FLEX, PDF,PPT
 
Posts: 156 | Location: Essen Germany | Registered: December 02, 2010Report 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] Text Box automatically filled

Copyright © 1996-2020 Information Builders