NetTalk Central

Author Topic: Dynamically create entire forms  (Read 3066 times)

Flint G

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Dynamically create entire forms
« on: December 21, 2009, 02:15:58 PM »
Hello NTC,

Disclaimer: I'm an admitted novice when it comes to NetTalk, but I know enough to get myself into trouble.  That said:

I want to create an entire form dynamically out of a table with an undefined number of rows, where each row will create a single entry field.  I will use values in the different columns to determine the "ID" and "Name" of the entry fields.  I'll basically be creating one "field" on the tab from the same column for each row (versus the typical form style of creating one field for each column in the same row).

My question is: What is the best way to do it?  I could try to dupe the NT code using OMITs and manually add code, etc.,  :-\ , I could dynamically create the HTML page and store it in the web directory then serve that temporary page, or is there a better way?  It sure would be nice if I had some way of doing it through the NT paradigm!

Aside: Can NetTalk serve and handle PHP?

Thanks a TON!

Regards,
Flint
NetTalk: 12.26
Clarion: 9.1.11529
Brave: 1.31.88
Chrome: 95.0.4638.69
Edge: 95.0.1020.44
ExtJS: 7.0.0.156

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Dynamically create entire forms
« Reply #1 on: December 21, 2009, 11:25:36 PM »
Hi Flint,

Let's cover the easy stuff first.

>> Aside: Can NetTalk serve and handle PHP?

NetTalk 5 - yes. "Static" pages in the web folder (or sub folders) with the php extension, are passed to php for processing. At this stage you can't just "embed" php code into a page (although that may also be possible soon.)

Now to your dynamic form question.
The answer is both yes - for a "simple" form, and "no" for a dynamic form. Or at least, if not "no", then a _very_ guarded "yes".

Let's again, start simply.
Embedding html code into a Form procedure is trivial. There are plenty of embed points for that - and I'd even recommend using a NetWebSource, and then calling the NetWebSource from an appropriate point in the form. So between the
<form>
</form>
tags you can send pretty much anything you like.

You way want to inspect the code used to create common form controls (.CreateXXX) methods in the class (netweb.clw). By using these methods rather than direct HTML code, you'll get better results.

Making the fields dynamic will be quite difficult. Apart from needing to create a generic "handler" for each field (usually generated as prompt::xxx, value::xxx etc routines) you'd also need to add embed code to the WebHandler procedure to direct the updates appropriately. That's probably beyond the scope of this request.

Cheers
Bruce

Flint G

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Dynamically create entire forms
« Reply #2 on: December 22, 2009, 04:23:35 PM »
Thanks, Bruce!  You are always so quick to respond, and that helps a lot!

I will try some of these means, and I'm sure I'll be back on here soon.

Regards,
Flint
NetTalk: 12.26
Clarion: 9.1.11529
Brave: 1.31.88
Chrome: 95.0.4638.69
Edge: 95.0.1020.44
ExtJS: 7.0.0.156

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Dynamically create entire forms
« Reply #3 on: December 23, 2009, 03:14:19 AM »
You might want to even think about using EIP on a browse. Column 1 could be your prompt and column 2 your entry field. Use CSS to get the look you want like getting rid of all the borders etc.


Flint G

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Dynamically create entire forms
« Reply #4 on: March 05, 2010, 01:14:29 PM »
Bruce & Kevin (and anyone else who's curious about the same thing),

I was able to make it work, and it works quite nicely.

I took Bruce's suggestion and thoroughly inspected the code generated by the templates, as well as the related methods in netweb.clw.  After understanding exactly what the NetTalk template code was doing, I was able to create a generic source code loop that would mimic the NetTalk code.

I modified (slightly) an object we already used to build dynamic windows in our Windows app to provide the information I would need (such as field names, types, values, restrictions, etc.) to provide output that would then be inserted into the loop when generating the form.

The action page (where the form posts to) then receives the posted values, loads them back into a new instance of the object (as well as the session queue), and displays them for the user to approve (after the object validates the data using its own methods, already in use by our Windows app).  Later in the process I actually commit those values to our Database ... which are then viewable in our Windows app.

It turned out to be very simple, and a lot easier than I was expecting it to be.  What I haven't done yet, but might consider, is allowing for "real-time" verification of the fields (i.e. duplicating the "Send new value to server" feature of regular form field.

Thanks, Bruce and Kevin for your suggestions!  NetTalk just got even more exciting.  8)

Regards,
Flint
NetTalk: 12.26
Clarion: 9.1.11529
Brave: 1.31.88
Chrome: 95.0.4638.69
Edge: 95.0.1020.44
ExtJS: 7.0.0.156

Flint G

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Dynamically create entire forms
« Reply #5 on: March 05, 2010, 01:27:04 PM »
Perhaps I should point out that my "dynamic" forms are only dynamic insofar as compile-time is concerned.  Our users have the ability to create custom forms in our Windows apps, with associated verification (calculation) logic.  The web forms won't be dynamic at web-access time ... they're actually static in that respect.

- Flint

Hello NTC,

Disclaimer: I'm an admitted novice when it comes to NetTalk, but I know enough to get myself into trouble.  That said:

I want to create an entire form dynamically out of a table with an undefined number of rows, where each row will create a single entry field.  I will use values in the different columns to determine the "ID" and "Name" of the entry fields.  I'll basically be creating one "field" on the tab from the same column for each row (versus the typical form style of creating one field for each column in the same row).

My question is: What is the best way to do it?  I could try to dupe the NT code using OMITs and manually add code, etc.,  :-\ , I could dynamically create the HTML page and store it in the web directory then serve that temporary page, or is there a better way?  It sure would be nice if I had some way of doing it through the NT paradigm!

Aside: Can NetTalk serve and handle PHP?

Thanks a TON!

Regards,
Flint
NetTalk: 12.26
Clarion: 9.1.11529
Brave: 1.31.88
Chrome: 95.0.4638.69
Edge: 95.0.1020.44
ExtJS: 7.0.0.156