NetTalk Central

Author Topic: Embedding Custom Checkboxes in Form Via Browse Call (NTWS4)  (Read 4011 times)

Rob Mikkelsen

  • Full Member
  • ***
  • Posts: 107
    • Yahoo Instant Messenger - flashpott
    • View Profile
    • Email
NTWS 4 - This is a real newbie question but I cannot seem to make it work for me...

I have 41 checkboxes that obtain their data to a string and the checked boxes concatenate their check value (code) to create a new string when completed.

Rather than creating local variables for each, I have written a source procedure that builds the name for each variable dynamically based on its index (Check01 through Check41).  I insert that data into the NTWS form as a browse procedure called from the form.  The source code properly creates the table and it is displayed correctly in the browser.  When the form is submitted I cannot find the data returned in the value queue.

I found that simply embedding a source call to the routine to display the checkboxes returns the appropriate values in the value queue when I process the form, but when I use it as a browse call it does not return values.  I like the idea of being able to refresh the checkboxes via some trigger in NetTalk's AJAX processing, but I cannot find any values returned from the procedure when the form is submitted.

What am I missing?  How can I get the values from my embedded source called via the browse call in an NTWS 4.0 form to return values to the form?

Thanks!

Rob

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Embedding Custom Checkboxes in Form Via Browse Call (NTWS4)
« Reply #1 on: May 11, 2010, 05:21:36 PM »
Hi Rob,

Can you post a screen shot to help me understand what you are trying to do clearer?

Cheers,

Kev

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: Embedding Custom Checkboxes in Form Via Browse Call (NTWS4)
« Reply #2 on: May 12, 2010, 12:58:17 AM »
Hi Rob,

I think I understand what you're trying to do.

If you want the checkboxes to be dynamic, then make 41 local variables, and add the fields in the normal way. Dynamic fields have quite a lot of code generated for them to make the dynamic stuff work. In theory you can duplicate all that, but frankly it's not worth the effort, and your app would be subject to possible regressions as stuff changes.

If the checkboxes are completely static, then their values will be in the Value queue when a form is _saved_. You should handle them in the ValidateRecord routine - copying them back into your string and so on. By inspecting the WebServer procedure log you should be able to see what they're called.

Oh - except that remember that checkboxes that are unticked are typically not included in a Post. (NetTalk knows this, so is able to do it for you for normal checkboxes.) In a normal HTML post only ticked checkboxes exist.
There's a routine generated on a normal form, for checkboxes, called "Complete Check Boxes". It has code something like this;
          If p_web.IfExistsValue('FNAM:InvitationOnly') = 0
            p_web.SetValue('FNAM:InvitationOnly',false)
            FNAM:InvitationOnly = false
          End

Cheers
Bruce


Rob Mikkelsen

  • Full Member
  • ***
  • Posts: 107
    • Yahoo Instant Messenger - flashpott
    • View Profile
    • Email
Re: Embedding Custom Checkboxes in Form Via Browse Call (NTWS4)
« Reply #3 on: May 12, 2010, 04:36:24 AM »
Bruce,

They don't have to be dynamic inasmuch that a have to trigger code to accomplish something when a checkbox is selected/deselected - I just need to be able to refresh the group if the "select all" checkbox (a defined variable in the NT form) is checked.  I figured with the "select all" would be a variable in the form and the rest of the checkboxes would be in a source procedure that could be refreshed with one call instead of having to do 41 different resets.  However, when I call the source as  a browse procedure, I did not get any of the expected variables (checked boxes only - unchecked ones are not returned) back.

I decided to forego the "select all" reset and embedded the same source procedure in the "Generate Form / Tab / Field / After Row" embed which did return the expected results.

I will try this again and check to see if the data is available where the form is saved.  I have put STOP() messages in the RestoreMem, Post Update, PreUpdate, Procedure Setup and everywhere else I can think of but I cannot find the data in the value queue after posting the form.

I can create each field separately but I would prefer to be able to generate the checkboxes on the fly so I can change the order or number of fields if I need to in the future by updating the database and have everything flow from there.

Rob



Rob Mikkelsen

  • Full Member
  • ***
  • Posts: 107
    • Yahoo Instant Messenger - flashpott
    • View Profile
    • Email
Re: Embedding Custom Checkboxes in Form Via Browse Call (NTWS4)
« Reply #4 on: May 12, 2010, 04:41:01 AM »
Kevin,

Here is the code that I used.  It is not very dynamic at the moment, but I am planning to load it from a database after I get the functionality working.  This will allow anyone to set the fields they want to capture in the report and, eventually, set the order in which they appear.

Rob

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: Embedding Custom Checkboxes in Form Via Browse Call (NTWS4)
« Reply #5 on: May 12, 2010, 08:52:22 PM »
Rob,

Ok, just to be clear though, the browser will ONLY add "checked" checkboxes to the Value Queue.
It's standard behaviour for browsers NOT to include unchecked checkboxes in a POST. ie missing values means the checkbox is false.

Other than that everything you're doing should work.

Cheers
Bruce

Rob Mikkelsen

  • Full Member
  • ***
  • Posts: 107
    • Yahoo Instant Messenger - flashpott
    • View Profile
    • Email
Re: Embedding Custom Checkboxes in Form Via Browse Call (NTWS4)
« Reply #6 on: May 13, 2010, 05:26:54 AM »
Bruce,

Yes - I understand that unchecked checkboxes will not be returned to the value queue.  The issue I have is the NONE of the checkboxes are returned to the value queue.

I will continue to work with it and let you know what I find.

Cheers!

Rob