NetTalk Central

Author Topic: Refresh Second Browse  (Read 6069 times)

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Refresh Second Browse
« on: October 19, 2012, 05:32:33 AM »
NT 6.46
On a static page, I have a memory form that updates a TPS file.  Also on that page, I have a browse of that file.  When the record is added to the file, I want to refresh the browse so it reflects the added record.  The memory form and the browse are obviously different procedures.

How would I cause the browse procedure to refresh the browse when the memory form updates the file?

I have tried to refresh the entire page (ugly), but the browse does not refresh with that.
Mike Springer

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Second Browse
« Reply #1 on: October 19, 2012, 07:51:50 AM »
Hi Mike,

what is the trigger that causes the memory form to update the file? ie does the user press a Save button? Is it a built-in Save button or an "other" button that's been added to the form?

Cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Second Browse
« Reply #2 on: October 19, 2012, 12:34:14 PM »
Bruce,
I'm sorry that I was so general - I should have included that info.

The trigger is a "button" type button as a field on the form.  In the Validate::MyButton - Add Server Code embed, I have code to insert the record into the file.

That is all I am doing with that - mainly because I don't know how to trigger the browse refresh.

By the way (perhaps as an aside), I am keeping the form visible on the screen by embedding  "Do PreInsert" (no quotes) in the PostInsert embed.  The form stays on the screen and I can enter the next item immediately.  I don't know if this would be the preferred method, but it is working great (but I am not triggering the browse refresh).

Mike

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Second Browse
« Reply #3 on: October 19, 2012, 10:52:28 PM »
>> mainly because I don't know how to trigger the browse refresh.

ok, that part is easy. Go to the button, to the client-side tab, and add the browse to the list of "reset fields" there.

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Second Browse
« Reply #4 on: October 20, 2012, 04:37:34 PM »
Bruce,
There is something that I am not understanding.  When I go to the Form's "button" field (which is a "type" of Button), and go to its Client Side Tab to enter a reset field, the only option available is to select one of the fields on the form - I can't select another procedure (like a browse procedure). 

BTW, I've attached a screen shot of the static page with the various browses and the memory form.

Mike

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Second Browse
« Reply #5 on: October 21, 2012, 08:47:17 PM »
Hi Mike,

>> On a static page, I have a memory form that updates a TPS file.  Also on that page, I have a browse of that file.  When the record is added to the file, I want to refresh the browse so it reflects the added record.

Ahh - the missing clue. I didn't spot that you'd cobbled this together on a static page.

So here's where you're fresh out of luck as they say. By building this on a static page there is none of the "structure" that comes from building it up from say a Form base. Remember when said I didn't recommend this route because it will lead you into limitations? Well that moment has arrived.

I recommend removing the browse tag from the static text, and adding it to your form part. (Forms can take Browse procedures as a form field.) You can of course add static html to the form itself as well.

It is _possible_ to call the browse from embed code on the form, to get it to refresh, but that hand-code would need to be very carefully crafted, and would be prone to failure as the browse code in nettalk changes etc, so I do not recommend that approach.

cheers
Bruce


cheers
Bruce


springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Second Browse
« Reply #6 on: October 22, 2012, 04:40:59 AM »
Bruce,
Yep - I know of your advice to move away from static pages, and for the most part I have.  This is one app that I am still in process of moving away from static pages, and this particular page is really a prototype to work out a satisfactory mechanism.  If I can do this page without a static approach, that would be great - but, I don't know how to do otherwise.  Help!

To review the page (see the attached graphic), I have the following objects:

1. Memory form for entering the Contribution date (that the subsequent contributions will utilize for the date)
2. Browse for the Families of the organization.
3. Browse for the members of the selected family (in case the contribution is from a family member rather than from the family)
4. Disciple of the selected family or family member.
5. A memory form for entering the basics for the Contribution (like check number and total amount) - the rest of the record info is from the selected family and contribution date)
6. A browse of the current batch of contributions (this is the browse that is not being refreshed when the memory form (5) enters a record.
7. A browse for the detailed (child) records of the current Contribution record.  I use a popup form for entering these records.

I'm using CSS for the section borders and section titles and for positioning the NetTalk objects.

I just did not know how to approach this complex screen without using a static page to "hold" all the NetTalk objects. 

Bruce, can you give some suggestions as to how to approach this without using the static page to hold the components?  I would love to move away from the static approach on this if I had an idea of how to approach it.

Thanks,
Mike




[attachment deleted by admin]

JPMacDonald

  • Full Member
  • ***
  • Posts: 106
    • View Profile
    • Email
Re: Refresh Second Browse
« Reply #7 on: October 22, 2012, 03:14:41 PM »
Quote
It is _possible_ to call the browse from embed code on the form, to get it to refresh, but that hand-code would need to be very carefully crafted, and would be prone to failure as the browse code in nettalk changes etc, so I do not recommend that approach.

Bruce,

I've been using this "technique" to refresh a browse that is not a child of the form by just calling the browse in the embed after the code associated with the button is complete. I do this (not making the browse a field on the form) primarily because I have more control over the layout and where things appear. This seems to be working fine but your observation makes me scared that this could break with any given update.

What exactly would a "carefully crafted" peice of hand code look like to refresh the browse this way?

Regards

Parker

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Second Browse
« Reply #8 on: October 23, 2012, 02:27:34 AM »
I may be a tad over-dramatic here.

yes you can literally (in most places) just call the browse procedure as part of the response.
A few of the examples do this.

The key is knowing the "stage" to call the browse in. The browse uses Values (from the value queue) to determine the stage, so sometimes you need to Delete values before calling the browse to ensure it is in the right stage. If you look at the generated code you'll see the stages it looks for, and from the debugview you can see which stage is running, so it's not hard to make this work.

In terms of the future - you may need to add additional delete's if a new stage is created (and obviously if that stage propogates from a form.)

cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Second Browse
« Reply #9 on: October 23, 2012, 02:28:54 AM »
Mike,

I would star with a NetWebForm, which can contain all the items on your page.

Actually I'd use the "wizard" form and split your "steps" into pages on the wizard. That would lead to a cleaner
interface as well.

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Second Browse
« Reply #10 on: October 24, 2012, 04:34:45 AM »
Bruce,
OK, I'm trying a Form "wizard" tabs modeled after the "Tabs" example.  But, the Previous button is not being disabled at the first tab and the Next button is not being disabled on the last tab, and the Save button is active on all the tabs.

I don't see anything that I am doing different from the tabs example.  Do you have a suggestion of where I should look to get the buttons to  behave like a normal wizard?
Mike

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Second Browse
« Reply #11 on: October 24, 2012, 09:38:52 PM »
what build are you working with Mike? They seem to be enabling / disabling ok here.
Perhaps you can try in one of the example apps and see if you get the same effect there?

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Second Browse
« Reply #12 on: October 25, 2012, 03:54:32 AM »
Bruce,
I'm running 6.48.  The Tabs (57) example works fine here.  Hmmm....
I've imported the fWizard form from the Tabs example into my app, and it does not disable the Prev and Next buttons and Save button at the right places.

I've attached a screen shot of the Tabs(57) Wizard form and the same form imported into my app.  fWizard1 is the example and fWizard2 is the same form imported into my app (notice the Prev button and Save button is not disabled).  Also notice the different button format for the prev/next/save buttons.  That is the only thing I can see that is different, but I do not see anything in the form selections that are different - I made no changes to the Form after importing it.

Mike

[attachment deleted by admin]