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.
I have run into a problem that has me scratching my head. I have a maintain project that has two tables...one for person info and another for order info. My goal is to add an event handler(either onChange or onBlur) that executes when someone enters a PersonID on an AddOrderForm. The code should check the Person table to see if that PersonId exists, and if it does exist display the persons name on the screen. If it doesn't a JS confirm box should pop-up asking the user if they would like to add a new Person record. The code that checks to see if the person exists follows
STACK CLEAR GetPersonStack;
REPOSITION fow_clients.FOW_CLIENTS.PERSONID;
NEXT fow_clients.FOW_CLIENTS.PERSONID INTO GetPersonStack WHERE fow_clients.FOW_CLIENTS.PERSONID EQ AddOrderStack(1).PERSONID;
COMPUTE exist=GetPersonStack.FocCount;
I bound the variable 'exist' to a hidden field on the form where the JS function can look. If the value is 1 then display the name...if it is 0 then display confirm box asking to enter new Person record. The problem is that the JS function fires off before Maintain can set the value in the hidden field, so JS always sees 0 in the field even if there is a Person record corresponding to the PersonID. I have tried making the event handler JS, and having it call the above Maintain code...then use a setTimeout command to give Maintain a chance to populate the 'exist' editBox, but this doesn't seem to work either. When I test the app I can see that the field is being populated with a 1 only after the event handler has completed. The Person table only has a few hundred records so it doesn't take long for Maintain to find the record, but that field only populates when the event handler is over.
If anyone has any suggestions or alternate ideas on how to achieve this functionality I am all ears.
P.S. on a related note why does the focus always return to the PersonID field when I run this event handler? Even when I explicitly set the focus to another field the focus returns to PersonID after having tabbed off the field and launching the event handler. When the event handler is onChange this isn't a major issue because if you hit tab again you move to the next field, but when it is onBlur you just get stuck tabbing and then returning over and over again.
ThanksThis message has been edited. Last edited by: brjohnson,
Bryan Johnson WebFOCUS 7.7.03 Maintain Win 7 Excel, PDF, HTML
Am I right in assuming that you bound the js function that checks the hidden field to the onchange event? If so, then what happens is making sense. Consider the timing in this. When something changes in the id field, then the js gets activated. This one does two things - call a maintain case, and checks the field. But, these two things are mutually exclusive, because the first takes place on the server (requiring the js to exit) and the other one locally (requiring the js not to exit). Split the js functions. One to act upon the change of the field and call the maintain case. This will return control to the server and result in a new page, with all data filled in. This function needs to be bound to the id-field. Then have a second js function that will act upon the value of the hidden field. This piece of js has to be bound to the form itself (done by dragging the js from the project explorer onto an empty space on the open form). This latter js will get executed after the page has been loaded.
Hope this helps ...
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
The first is just with Maintain and not JavaScript. I would place a button or a text message on the form and make it Visible No. Then, if the person is not found, I would use: WINFORM SET form.object.visible to YES
This displays the message and you can trigger what ever you want. Make it Visible NO when you are done.
The second is a JavaScript solution, but uses the OnLoad.JS funtion. This is attached to the form, and is run EVERY time the form is refreshed. So, you could have:
var OriginalOnload = document.body.onload; document.body.onload = LoadFunct;
function LoadFunct() { if (OriginalOnload) OriginalOnload (); if (document.Display.X_Edit.value.length != 0) { var msgtext = Display.X_Edit.value; alert(msgtext); Display.X_Edit.value = ''; } }
This routine checks a field on the form, and if it has a value, pop up a message. You could have it kick off another JavaScript routine or whatever else you need. Just remember to clear out the checked field when done, or the message will be displayed everytime.
Mark
Posts: 663 | Location: New York | Registered: May 08, 2003
I was able to get it working...I chose to use the Maintain only strategy for checking for the user. I used the JS onLoad function to set the focus to the field after ID, if the ID field contains data, to prevent an endless tabbing loop. Just one thing still kinda bugs me(and its not a real big deal) the data in the ID field remains highlighted even though the focus is set on the next field. Like I said its not a big problem, but I was just curious if anyone knew why this was happening.
Thanks again for the help
Bryan Johnson WebFOCUS 7.7.03 Maintain Win 7 Excel, PDF, HTML
Just one thing still kinda bugs me(and its not a real big deal) the data in the ID field remains highlighted even though the focus is set on the next field.
Set the .select method as well as the .focus, and that should take care of it.