NetTalk Central

Author Topic: Strange Tab behavior  (Read 2445 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Strange Tab behavior
« on: March 22, 2012, 11:38:10 AM »
Hi
I have a form that has 3 tabs. I'm using the Rounded form so the tabs open one beneath the other.
2 of the tabs are for normal data entry and the 3rd is for the user to handle an error condition.
Because of the way users are, I want to hide the 2 entry tabs while displaying the error tab and vice versa.
This all seems to work well enough until the user hits Save. Then the processing is supposed to move to a payment method page.
When the payment page is attempted, I get just raw HTML code in the browser starting with this -

<script defer="defer">
jQuery(function() {jQuery("#UpdateOrders_frm").ntform("showTab",2);});

</script>
<script defer="defer">
jQuery(function() {jQuery("#UpdateOrders_frm").ntform("showTab",0);});

</script>
<script defer="defer">
jQuery(function() {jQuery("#UpdateOrders_frm").ntform("hideTab",1);});

</script>
<script defer="defer">
jQuery(function() {jQuery("#UpdateOrders_frm").ntform("showTab",2);});

</script>
<script defer="defer">
jQuery(function() {jQuery("#UpdateOrders_frm").ntform("showTab",0);});

</script>
<script defer="defer">
jQuery(function() {jQuery("#UpdateOrders_frm").ntform("hideTab",1);});

</script>
HTTP/1.1 200 OK
Date: Thu, 22 Mar 2012 18:55:54 GMT

That looks like the tabs code was still in the packet when the payments page is loaded. The http/ ... etc is the header of the payments page.

I've been flailing at this for a day or so now.
Can anyone give me a clue where I might look to see where I went wrong?

Thanks,
Chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Strange Tab behavior
« Reply #1 on: March 22, 2012, 11:28:38 PM »
It's really hard to comment on things you may, or may not, have done wrong without seeing an example.
Can you maybe create a small example, based on one of the shipping examples would be fine, demonstrating the effect?

cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Strange Tab behavior
« Reply #2 on: March 23, 2012, 05:31:20 AM »
It seems to be connected more to the way I use sendalert inside routines rather than just exiting a routine with loc:invalid set to something.
This is a fairly involved form, but maybe making it into a sample would cause me to see what I'm doing.

I'm not sure of the correct way to cause the tabs to hide and unhide. And whether the problem is possibly having loc:invalid being set to a field on the hidden tab.

The Save button is what puzzles me, too. If there is an error and I exit from ValidateAll, why is it still trying to go to the URL on Save instead of reloading the form?

Any suggestions on those 2 points?

In the meantime, if I can make a sample, I'll send it to you. If I figure it out, I'll post the answer.

Thanks,
Chris
Real programmers use copy con newapp.exe

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Strange Tab behavior
« Reply #3 on: March 23, 2012, 12:04:27 PM »
Bruce - I upgraded to 6.26 and tried making a sample starting with the TABS(57) example. Those tabs don't work either even before I tried my stuff.

Could you take a look at that? I copied in the new web folder and fiddled with the menu to make it look ok, but the tabs seem to be nroken.

chris
Real programmers use copy con newapp.exe

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Strange Tab behavior
« Reply #4 on: March 24, 2012, 05:38:45 PM »
Answering my own questions.
As usual, I was doing too much. I got the sample to work well enough to show what was going wrong. a single session value was all that was needed. Flip it on and off toggled the entry and warning tabs. Very effective.

BUT - in doing that I found that code that I had in the server code embed after my lookup wasn't reliable. It was ignoring the code I had placed after the lookup routine to do some relational gets.

I noticed that the AfterLookup routine is called AFTER the validation "Server code" embed. Why is that?
That makes it impossible to use the looked up information to be used in the validation.
I copied it -   p_Web.SetValue('lookupfield','Ord:InvId')
        do AfterLookup
into the embed before my validation and lo and behold everything is working!

I have to ask wouldn't it be better to have that after lookup code after the Do ValidateValue::fieldname line BEFORE the server code embed?

chris

Real programmers use copy con newapp.exe