Focal Point
[CLOSED] Handling forms in webfocus maintain

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6817075306

May 10, 2011, 07:00 AM
Shankar
[CLOSED] Handling forms in webfocus maintain
Hi All,
I have a dropdown in maintain screen which populates the HTML table based on the value selected.There is a corresponding flag values for each values of dropdown in datasource.I want to make whole HTML table disabled (grey out) if flag value is 'Y' so that user can not interact it with further.If the flag value is 'N' the HTML Table will be active.How can I handle this in maintain?

Thanks in advance.

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


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
May 10, 2011, 10:58 AM
Maintain Wizard
If you want to entire table to disappear use this Maintain command:
Winform set Form1.HTMLTable1.Visible To 0
To make it reappear use:
Winform set Form1.HTMLTable1.Visible To 1

If you want it to appear but not active use:
Winform set Form1.HTMLTable1.Enabled To 0
To make it active use:
Winform set Form1.HTMLTable1.Enabled To 1

Where Form1 is the name of your form, and HTMLTable1 is the name of your HTMLTable.

Mark
May 11, 2011, 02:26 AM
Shankar
HI Mark,
I have some links also present in the HTML Table.I also need to disable those links as those links are still working. i.e, The colors are greyed out but on clicking the links it is performing the underlying tasks.How to disable or hide those links in HTML table in maintain?Please suggest.

Thanks.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
May 12, 2011, 05:49 AM
Shankar
Hi,
I am Trying to hide those links in javascript by using below piece of code :

 
document.getElementsByTagName("tr")[i].cells[k].style.visibility = "hidden";
 


I am using this in javascript after calling maintain function in which the HTML table is disabled based on the flag value of value selected in dropdown list.But this is not working and links are still executing its underlying function.Can you suggest where I am doing wrong or any alternate way to handle this?

Thanks.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
May 12, 2011, 09:42 AM
Alan B
Try
document.getElementsByTagName("tr")[i].cells[k].innerHTML.style.visibility = "hidden";



Alan.
WF 7.705/8.007
May 12, 2011, 05:34 PM
Waz
Be aware that different browsers will handle the code in different ways.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 13, 2011, 12:11 AM
Shankar
Hi,
Its still not working.I am using IE8 browser.Please suggest some way to handle this?


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
May 13, 2011, 03:52 AM
Alan B
Shankar

Your original code should work if you are using plain href links. Can you post an example of the table and your javascript.


Alan.
WF 7.705/8.007
May 13, 2011, 07:03 AM
Shankar
Hi Alan,


Here is the sample HTML table and code. I am using EMPDATA as datasource here.In my HTML table I have 6 columns Pin,Lastname,Firstname,Div,App,App1.Column App and App1 are having links in each row of the table.My maintain code looks like:

MAINTAIN FILE empdata

$$Declarations
Declare SelDiv / A4 ;

Case Top

Infer empdata.EMPDATA.PIN into EmpStack;


EmpStack.app/a200;
EmpStack.app1/a200;

getEmp( );

Winform Show Form1; 
-* Replace the Winform Show command with the following code
-* when to display your form in a non-persistent state
-* Winform Show_And_Exit Form1;

EndCase

Case getEmp
Reposition empdata.EMPDATA.PIN ;
Stack clear EmpStack ;
For all next empdata.EMPDATA.PIN into EmpStack() 
Where (DIV EQ SelDiv );

if SelDiv eq 'CORP' begin
Winform set Form1.HTMLTable1.Enabled To 0; 
endbegin
else Winform set Form1.HTMLTable1.Enabled To 1; 

Show( );

EndCase
 
Case Show
Declare (i/i4);


repeat EmpStack.foccount  i = 1;

Compute EmpStack(i).app = '<A href= "" target="_blank" onclick="IWCCB(event);IWC_HTMLTable1(this,0);return false;">GENERATE REPORT</A>'
endrepeat i= i+ 1;

repeat EmpStack.foccount  i = 1;

Compute EmpStack(i).app1 = '<A href= "" target="_blank" onclick="IWCCB(event);IWC_HTMLTable1(this,0);return false;">GENERATE REPORT</A>'
endrepeat i= i+ 1;

EndCase

END



I have a dropdown which contains DIV values based on which HTML table is populated.Here, Iam checking selected DIV value to enable or disable HTML table.In this sample code I have taken CORP value to disable the table.i.e If CORP is selected the whole table will be disabled else it will be enabled.
Now,When the table is in disabled condition the links should also disappear from the table which I am trying to handle in javascript below:


 
function OnComboBox1_Change ( )  {

  var oRows = document.getElementById('HTMLTable1').getElementsByTagName('tr');
  var irows = oRows.length ; 

IWCTrigger("getEmp");

for(i=1; i<=irows; i++){

document.getElementsByTagName("tr")[i].cells[5].style.visibility = "hidden";
document.getElementsByTagName("tr")[i].cells[6].style.visibility = "hidden";

}
}



I am bit confused whether this the right way to handle this or not.Please suggest.

Thanks.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
May 16, 2011, 04:56 AM
Shankar
Can anybody reply to this please?

Thanks.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
May 16, 2011, 08:55 AM
Maintain Wizard
Ok - This can be handled like this. Use Maintain to disable the HTMLTable with:
Winform set Form1.HTMLTable1.Enabled To 0

Then change the ClickLink function to JavaScript with this code:

function OnHTMLTable1_ClickLink ( ) {
if( !(document.getElementById("HTMLTable1_mainDiv").disabled) )
{
alert("good");
}
}

Instead of just an alert you can use IWCTrigger to perform a Maintain case or anything else. This code ONLY allows the clicklink to work when the object is not disabled.

Mark
May 16, 2011, 12:18 PM
Alan B
Shankar

As before, you cannot process any javascript after an IWCTrigger. The IWCTrigger is a form submit function and any js after that will be ignored.


Alan.
WF 7.705/8.007