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 DYNAMICALLY set the initial value of selectedvalue in html

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED]How to DYNAMICALLY set the initial value of selectedvalue in html
 Login/Join
 
Gold member
posted
I would like to be able to dynamically set the INITIAL value of the selectedvalue argument in the HTML SELECT tag.

 <SELECT id=edit3 style="LEFT: 680px; WIDTH: 60px; POSITION: absolute; TOP: 14px" tabIndex=8 size=1 name=STRT_PER 
IBIMR_domain="custtrnd/custtrnd.htm" IBIMR_folder="#forecastings" width="0" vspace="0" indeterminate="false" 
accept="0" CHECKED="false" loop="1" maxLength="5" hspace="0" height="81899636" readOnly="false" 
start="fileopen" labelid="text3" addalloption="0" operation datasource="app/mktfcstddstrt.fex" 
boundtovariable="1" requiredfield="1451482" datatype="1" sourcetype="typeFex" cacheruntimedata="1" selectedvalue="0901"> 


The list box has more than 24 months, it's purpose is to set the starting month to be passed to a fex. I don't want either the lowest or highest month set initialy, but rather the current month minus 6. The reason is the called fex is autoexecuted and the widest possible date range retrieves too much data for an initial display of a graph/report.

I'm looking for a way to have the list box contain all the availalbe months both backward and forward from the hopefully defaulted selected date value. In my sample the selectedvalue is initialy set to '0901', but next month I would like this be set to '0902' without having to modify the html manually.

Any suggestions or someone pointing me to documentation would be greatily appreciated, as my searches come up blank.

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


Laure


Prod: WebFOCUS 7.7.03 - MRE, BID, - WindowsXP - Oracle 9i, SQLServer, DevStudio 7.7.3 - Apache Tomcat , Output: HTML, Excel 2013 and PDF
 
Posts: 78 | Location: Florida | Registered: December 07, 2006Report This Post
Expert
posted Hide Post
Check out the use of "-DEFAULT" for the associated variable in your fex and then associating the HTML control with that variable. This should "pick up" the DEFAULTed value... In the GUI (HTML Layout Painter / HTML Composer)...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Hi Laure,

I think we created a DATE fex that has a calculation that creates this variable; I don't recall if it was a global or local.

Do
-? &

and see if there is an amper, then, in your HTML:
 
  
  Change
selectedvalue="0901"> 
  to
selectedvalue="!IBI.AMP.AMPER_NAME"> 

HTH

Hi to all...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Don't forget the semi-colon at the end of "selectedvalue="!IBI.AMP.AMPER_NAME;"
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
quote:
"selectedvalue="!IBI.AMP.AMPER_NAME;"
Only really useful (and operational) if the HTML file is contained within an HTMLFORM within a fex where the amper variable is available and you have supporting code for the non standard attribute "selectedvalue". Your signature states that you are using 7.6.4 but has this code been produced in 7.6.9 - what IBIRLS JavaScript library does it use?

If, as I would guess, the HTML is not initiated within a fex then you would probably have to resort to setting the selectedIndex within JavaScript. The easiest method of doing this (if you always want the 6th item in your list), is with something like this in the onLoad function -
// Set the current selected to the 6th item (index goes from 0 - (n-1) where n is the number of items in the list)
document.getElementById("combobox1").selectedIndex=5;

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
Expert
posted Hide Post
if you're using a fex to create an xml file for your dropdown....and your fex could easily figure out what the selected date in your list should be ....
but then HOW do we make the XML file force a selected variable? the XML list seems to only show the list top to bottom, just as written, but HOW would we pick some value in the middle to be selected? and its not always going to be , say, #5 ?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
I was wondering about this myself recently but never had to actually do it. In the fex that creates the xml you could append something to the row that you want selected that would never normally occur. such as "@XXX" where @ could not be in the data. Then use javascript to loop through the listbox when the page loads and when you see the "@" remove it from the value and do the select.

It is clunky but would work. Is there an easier way?

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Expert
posted Hide Post
Currently the JavaScript that is used to build the option list uses a mask to filter out c0 and c1 values from within your XML. A fairly easy method would be to extend the XML output to include a third value to indicate which value should be "selected" on loading.

Think of the following fex to demonstrate -

DEFINE FILE CAR
  SELECTED/A8 WITH COUNTRY = IF COUNTRY EQ 'ITALY' THEN 'selected' ELSE '';
END
TABLE FILE CAR
SUM FST.COUNTRY
    SELECTED
 BY COUNTRY
ON TABLE PCHOLD FORMAT XML
END

This would produce the XML as follows -

  <?xml version="1.0" encoding="ISO-8859-1" ?> 
- <fxf version="1.0" data="hold">
- <report records="5" lines="5" columns="3" rows="5">
  <target format="" version="" type="" destination="HOLD" /> 
- <column_desc>
  <col colnum="c0" fieldname="COUNTRY" alias="COUNTRY" datatype="char" width="10" focus_format="A10"
 description="" accept="" help_message="" title="" within="" property="" reference="" valign="left" /> 
  <col colnum="c1" fieldname="COUNTRY" alias="COUNTRY" datatype="char" width="10" focus_format="A10"
 description="" accept="" help_message="" title="" within="" property="" reference="" valign="left" /> 
  <col colnum="c2" fieldname="SELECTED" alias="E03" datatype="char" width="8" focus_format="A8"
 description="" accept="" help_message="" title="" within="" property="" reference="" valign="left" /> 
  </column_desc>
- <table>
- <tr linetype="data" linenum="1">
  <td colnum="c0">ENGLAND</td> 
  <td colnum="c1">ENGLAND</td> 
  <td colnum="c2" /> 
  </tr>
- <tr linetype="data" linenum="2">
  <td colnum="c0">FRANCE</td> 
  <td colnum="c1">FRANCE</td> 
  <td colnum="c2" /> 
  </tr>
- <tr linetype="data" linenum="3">
  <td colnum="c0">ITALY</td> 
  <td colnum="c1">ITALY</td> 
  <td colnum="c2">selected</td> 
  </tr>
- <tr linetype="data" linenum="4">
  <td colnum="c0">JAPAN</td> 
  <td colnum="c1">JAPAN</td> 
  <td colnum="c2" /> 
  </tr>
- <tr linetype="data" linenum="5">
  <td colnum="c0">W GERMANY</td> 
  <td colnum="c1">W GERMANY</td> 
  <td colnum="c2" /> 
  </tr>
  </table>
  </report>
  </fxf>

It wouldn't take too much effort to recode the ibirls.js routines to filter out the selected value and set the selected attribute for the list item accordingly.

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
Expert
posted Hide Post
A method that will work (tested) without too much additional coding and without amending IB modules is to add the code I suggested above but make it easier to use. I've left the "// TODO:" comment to show where this code would be placed -

// TODO: Add your event handler code here
// Set the selected item in "combobox1" to the third item
   self.setTimeout('resetsel("combobox1",2)',10);
// Set the selected item in "combobox1" to the second item
   self.setTimeout('resetsel("combobox2",1)',10);
}
function resetsel(ctrl, num) {
   var selObj = document.getElementById(ctrl);
   selObj.selectedIndex = num;
   DoResetDownChainControls(document.getElementById(ctrl));
}

The self.setTimeout will kick off the enclosed function after 10 milliseconds which should give the comboboxes time to be populated (unless they are HUGE, in which case change the 10 to something larger).

The DoResetDownChainControls will reposition any chained items you have connected to the control you specify, if any.

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
Member
posted Hide Post
I added the statement beneath to my fex. The


-HTMLFORM BEGIN
<script id=changeCombos type=text/javascript>

function onInitialUpdate() {
document.getElementById('edit1').selectedIndex = !IBI.AMP.WKBEGIN;
document.getElementById('edit2').selectedIndex = !IBI.AMP.WKEND;
}


-HTMLFORM END

* WKBEGIN and WKEND are the indexes which I calculated before. (index in listboxs start with 0)

Also a simple java-script can be used to determine the index by comparing the display values.
Something like this ( untested ) should work
idListBox1b = parent.document.getElementById('lbSuppliers');
for (i=0; i if (idListBox1b[i].value == !IBI.AMP.DISPVAL) {
SelectTheIndex = i;
}
}


Member of Benelux
Usergroup
 
Posts: 20 | Registered: November 02, 2006Report This Post
Gold member
posted Hide Post
Thanks all who posted suggestions. In the end I included a value -select- to the top of the list via the HTML painter, and the called fex deals with calculating the desired default because the paramater is empty.

See the problem was that the default value to be selected from the listbox wasn't a fixed number in the list. My approach works and the customers are fine with it. And I don't modify any IB code.


Laure


Prod: WebFOCUS 7.7.03 - MRE, BID, - WindowsXP - Oracle 9i, SQLServer, DevStudio 7.7.3 - Apache Tomcat , Output: HTML, Excel 2013 and PDF
 
Posts: 78 | Location: Florida | Registered: December 07, 2006Report 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 DYNAMICALLY set the initial value of selectedvalue in html

Copyright © 1996-2020 Information Builders