Calling "dynamic" webform

Dear all

Is it possible to call the webpage form which name of the form is loaded from database? Example, my table’s structure is like below:

menu_code | menu_text | menu_form

T01 | Purchase Order | fpurchase
T02 | Receive Order | freceive
S01 | Sales Order | fsalesorder
S02 | Delivery Order | fdeliveryorder
S03 | Invoice | finvoice

If user choosing menu Sales Order, then the webpage form name fsaleorder will be shown.

I knew there was a post to explain how to call the webpage using Dictionary type. I modified the code using array technique to make a dynamic form name, but it’s always fail.

Thanks in advance

Anyone can help? Very appreciate for your help if any. Thanks

Which dictionary method are you referring to ?

This is definitely possible. Most my content and forms a loaded dynamically from the database as well.

I handle this a couple ways:

  1. Put each control of your form into a separate WebContainer
  2. Create a database table to represent the “form views”
    – You could create a simple table like “FormName”, “FormInfo” and have forminfo have a serialized version of your form.
    –You could also create a more complicated table that might look like:
    “Form Name”, “Index”, “Field Label”, “Field Type”, “MaxValue”, “MinValue” etc…
  3. You App would get the info from the database and loop through all the necessary information and dynamically load the correct WebContainers on top of each other.

You’ll probably need to create a mapping between either your form names or your form control names and their control in Xojo

Select case containerName Case "MyForm1" return new myForm1 Case "MyForm2" return new myForm2 ...

Michel, this post: https://forum.xojo.com/22159-is-there-a-way-to-get-a-handle-to-a-webpage-by-name

Brock, Thanks for your solution. Let me try first.

Very appreciate to both of you, guys.

[quote=193711:@Yun Sut]Michel, this post: https://forum.xojo.com/22159-is-there-a-way-to-get-a-handle-to-a-webpage-by-name

Brock, Thanks for your solution. Let me try first.

Very appreciate to both of you, guys.[/quote]

Ah, OK. That is indeed the method I posted. I do not understand what you mean by [quote] I modified the code using array technique[/quote]

That said, Brocks method works fine with pages as well :

Select case PageName Case "fSalesForm" fSalesForm.Show Case "fDeliveryOrder" fDeliveryOrder.Show ... end select

It has the advantage of not creating references to unused pages.