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.
We are trying to improve some of our front-end validation using Javascript. I have a standard Input Box (edit1) and a TextArea (textarea1). When the user enters some values in the input box we want to disable the textarea and change the background colour to grey.
I have got as far as disabling the textarea, but I can't get the syntax right for the background colour.
I thought I'd give you one more example. After this, unless a JS guru chimes in, you're on your own!!
The caveat: Because of the bacground color, the cursor goes to the url on the address line; you have to tab down to the box (ugh!).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
var oTxt1;
var dC='#E5E5E5';//disabled color
var eC='#FFFFFF';//enabled color
function endis(n){
var oRads = document.getElementById("edit1");
if(oRads.value != ""){// if text1 != "" a space means it is not blank
oTxt.removeAttribute('readOnly');
oTxt.style.backgroundColor=eC;
}
else{
oTxt.value='';
oTxt.setAttribute('readOnly',true)
oTxt.style.backgroundColor=dC;
}
}
onload=function(){
oTxt = document.getElementById('edit2');
oTxt.style.backgroundColor=dC;
oTxt.setAttribute('readOnly',true)
}
</script>
</head>
<body>
<form>
<input id=edit1 name="text1" type="text" value=""> Enter Text Box 1
<br>
<input id=edit2 name="text2" type="text" value="" onfocus="endis(this.id)">Enter Text Box 2 if Text 1 is not blank!
<br>
</form>
</body>
</html>
TomThis message has been edited. Last edited by: Tom Flynn,
I would only change a few things within Toms JS to make it -
<script type="text/javascript">
var dC="#E5E5E5";//disabled color
var eC="#FFFFFF";//enabled color
function endis(n) {
oRads = document.getElementById("edit1");
oTxt = document.getElementById(n);
if (oRads.value != "" && oRads.value != null) {
// if text1 != "" a space means it is not blank
oTxt.removeAttribute("readOnly");
oTxt.style.backgroundColor=eC;
} else {
oTxt.value="";
oTxt.setAttribute("readOnly",true)
oTxt.style.backgroundColor=dC;
}
}
onload=function() {
oTxt = document.getElementById("edit2");
oTxt.style.backgroundColor = dC;
oTxt.setAttribute("readOnly",true)
oRads = document.getElementById("edit1");
oRads.focus();
}
</script>
Basically adding a check for a null value otherwise focusing on text2 at page launch will allow you to enter text (using I.E.), also using the passed value to the "endis" function to prime the oTxt object.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Mark Did you ever get the answer to this that you wanted? I am using a Maintain form, but the following code DOES change the background color of the field to grey.