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]How to code javascript for comobox onchange?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED]How to code javascript for comobox onchange?
 Login/Join
 
Gold member
posted
I have four Html launch pages. Now, I want to create the main launch page to let user to select from a drop down box, which is a combobox. From “Requests & Data sources”, I have 4 Html there. In “Tasks & Animations”, I have “task2 Selection Changed comobox1 HTML File/xxxxx window” there, and task3, task4, task5 are similar with task2.

In “Embedded JavaScript/CSS”, I have “function comobox1_onchange(event)…” However, I think the Javascript I copied is not right, it’s not working. If any of you are javascript expert, please let me know how to code in “Embedded JavaScript/CSS” to make drop down box work. Thank you a lot.

This message has been edited. Last edited by: EdHou,
 
Posts: 56 | Registered: June 17, 2011Report This Post
Gold member
posted Hide Post
Please let me know, Thanks.

function combobox1_onchange(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here
var selValue = IbComposer_getCurrentSelection('combobox1');
for(var i = 0; i < combobox1_onchange.length; i++){

if (selValue == 'First Report' && combobox1[i].checked) {
IbComposer_triggerExecution('task2',1);
} else if (selValue == 'Second Report' && combobox1[i].checked) {
IbComposer_triggerExecution('task3',1);
}else if (selValue == 'Third Report' && combobox1[i].checked) {
IbComposer_triggerExecution('task4',1);
}else if (selValue == 'Fourth Report' && combobox1[i].checked) {
IbComposer_triggerExecution('task5',1);

}
}
}
//End function combobox1_onchange


WebFOCUS 8.0.09
WebFOCUS 7.7.05
DBMS: Oracle 11g
all output (Excel, HTML, PDF)
 
Posts: 56 | Registered: June 17, 2011Report This Post
Expert
posted Hide Post
I would suggest using the browsers developer tools to track the execution.

As a minimum, add in console.log or alert to see where the flow is going.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
The fact that you state that you "copied" some JavaScript leads me to believe that you do not know any JavaScript?

If that is the case then I would really urge you to try and learn it. Look at some sites such as W3Schools.com for some tutorials. You will benefit from it if you are going to be developing similar processes!

If I understand you correctly, you want to trigger a call to the internal "IbComposer_triggerExecution" function to initiate a task that you have built within the GUI, depending upon what the user has selected within a drop down list?

If that is the case then I would suggest using the ability of having the value within the drop down list declared as a procedure - which (providing you get it correct) should trigger the procedure as you need. There have been topics on this before on the Forum.

Alternatively, you could use a case statement like the following -
function combobox1_onchange(event) {
  var eventObject = event ? event : window.event;
  var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here

  switch(document.getElementById("combobox1").selectedIndex) {
    case 0:
      IbComposer_triggerExecution('task2',1);
      break;
    case 1:
      IbComposer_triggerExecution('task3',1);
      break;
    case 2:
      IbComposer_triggerExecution('task4',1);
      break;
    case 3:
      IbComposer_triggerExecution('task5',1);
      break;
    default:
      IbComposer_triggerExecution('task2',1);
  }
}
//End function combobox1_onchange

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, 2004Report This Post
Gold member
posted Hide Post
Waz and Tony, Thank you for your reply.

Yes, Tony, I want the user has selected within a drop down list for any one of the html.

Not working yet. I’ll continue to try.
 
Posts: 56 | Registered: June 17, 2011Report This Post
Gold member
posted Hide Post
I like to make a selection from the drop-down, and then click on the ‘Submit’ button to run the report.

This is working now:

function button1_onclick(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here


switch(document.getElementById("combobox1").selectedIndex) {
// switch(document.getElementById("combobox1").focus()) {
case 0:
IbComposer_triggerExecution('task2',1);
event.stopImmediatePropagation();
return;
case 1:
IbComposer_triggerExecution('task3',1);
event.stopImmediatePropagation();
return;
case 2:
IbComposer_triggerExecution('task4',1);
event.stopImmediatePropagation();
return;
case 3:
IbComposer_triggerExecution('task5',1);
event.stopImmediatePropagation();
return ;
default:
IbComposer_triggerExecution('task2',1);
}
}
//End function button1_onclick

Thank you again.
 
Posts: 56 | Registered: June 17, 2011Report This Post
Expert
posted Hide Post
EdHou, please update the title of your first post to include [SOLVED] or [CLOSED]


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Thank you for the reminder, Waz.
 
Posts: 56 | Registered: June 17, 2011Report 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]How to code javascript for comobox onchange?

Copyright © 1996-2020 Information Builders