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.

New TIBCO Community Coming Soon
In early summer, TIBCO plans to launch a new community—with a new user experience, enhanced search, and expanded capabilities for member engagement with answers and discussions! In advance of that, the current myibi community will be retired on April 30. We will continue to provide updates here on both the retirement of myibi and the new community launch.

What You Need to Know about Our New Community
We value the wealth of knowledge and engagement shared by community members and hope the new community will continue cultivating networking, knowledge sharing, and discussion.

During the transition period, from April 20th until the new community is launched this summer, myibi users should access the TIBCO WebFOCUS page to engage.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Dynamically change the text in an edit box in Maintain

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Dynamically change the text in an edit box in Maintain
 Login/Join
 
Gold member
posted
Hi,

I'm a noobie to Maintain so I apologize if this is a simple question. I was wondering how to dynamically change the text in an edit box. I have a form with three fields on it. I want the third box to automatically contain the product of the first two fields(hours * rate = pay). I want pay to be a read only field that only contains data when a change is made to hours or rate.

Any assistance would be appreciated.

Thanks

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


Bryan Johnson
WebFOCUS 7.7.03
Maintain
Win 7
Excel, PDF, HTML
 
Posts: 54 | Registered: January 16, 2008Report This Post
Virtuoso
posted Hide Post
This should be simple. Remember that when maintain is displaying in the browser you are dealing with HTML, so to change the page use javascript. You could achieve this in maintain itself, but that is overkill.

If you have 3 edit boxes with ids' of hours, rate and pay, then on the event handler on hours and rate create an event handler for an onchange event calling javascript, in there simply use code like:
document.getElementById("pay").value = document.getElementById("hours").value * document.getElementById("rate").value; 


Hope this does what is required.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Gold member
posted Hide Post
Thanks Alan I'm not sure why I didn't think of that, but that worked great.


Bryan Johnson
WebFOCUS 7.7.03
Maintain
Win 7
Excel, PDF, HTML
 
Posts: 54 | Registered: January 16, 2008Report This Post
Master
posted Hide Post
Please allow me to add in an additional solution. The JavaScript solution is excellent, but if the form redisplays, that value will disappear. While this way involves a return to the server, it is the way to do computes in Maintain.

I will assume that you have:

COMPUTE PAY/D7.2;
HOURS/D7.2;
RATE/D7.2;

And you have placed those fields on the screen. When the user enters Hours and Rate, you can either press a button or use an On_Change trigger for the rate field. You would have a Maintain case containing:

CASE GETPAY
COMPUTE PAY = HOURS * RATE;
ENDCASE

When you trigger that case, Pay will be set and displayed.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Platinum Member
posted Hide Post
Mark,

Can the two approaches be combined ?

That is, have the three fields bound to the three form objects (edit boxes) and use a Javascript blur event handler to calculate the Rate box value, which would then be returned to Maintain when the page is submitted.

What I am not sure of is if the Rate edit box is set to read-only at design time, will Javascript be able to change the vale at runtime without toggling that property ?

Dave


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
 
Posts: 165 | Location: Detroit Metro | Registered: September 17, 2003Report This Post
Virtuoso
posted Hide Post
Dave

I'm sure Mark will respond as well. JS and bound objects can be combined as you describe.

The readonly context is for the user and does not affect the JS capability to update it.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Master
posted Hide Post
As Alan points out, data inserted into a field via JavaScript will certainly be sent back to the server. However, if the form gets refreshed, value and attributes set only by JavaScript may get reset.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report 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     [SOLVED] Dynamically change the text in an edit box in Maintain

Copyright © 1996-2020 Information Builders