How to Properly Setup a Form Component?

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

How to Properly Setup a Form Component?

Postby john1598360627 » Fri Jul 22, 2022 11:52 pm

I'm confused on how to properly use Form Components.

https://wiki.servoy.com/display/DOCS/Form+Component

The wiki article talks about the implementation via code, but I'm curious more about how this works UX wise.


WHAT I WANT TO DO
Create my own 'components', just like the built-in Servoy ones. Like a Drop Down or a Badge. But I believe this is beyond the scope of Servoy.

As the wiki says,

Form Component in the Solution Explorer Tree is a special contained form used for simplified design and runtime optimization for the NGClient. The same behavior can be achieved via tabless tabpanel, but form component has optimized display because all elements are part of the same form, taking away the overhead of tabpanel and loading of another form.


So, it's more that it's a form that is embedded into another form. I assume the concept is to like, have a small collection of Servoy Components in this one, such that it can be reused?

What confuses me is, how do I actually change the values of the elements within the form component? And how or where do I set the onAction events?

For Example;

If I have a button in a Form Component, how do I set it's onClick event? Is it on the form it'll be embedded in, like within an onShow or onLoad event?

Also, how exactly do I display the Form Component? I assume by the FormComponentContainer right? But what exactly does List FormComponent Container do differently?
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to Properly Setup a Form Component?

Postby jcompagner » Mon Jul 25, 2022 9:33 am

john1598360627 wrote:I'm confused on how to properly use Form Components.

https://wiki.servoy.com/display/DOCS/Form+Component

The wiki article talks about the implementation via code, but I'm curious more about how this works UX wise.


WHAT I WANT TO DO
Create my own 'components', just like the built-in Servoy ones. Like a Drop Down or a Badge. But I believe this is beyond the scope of Servoy.



If you want to actually creating really components, then you need to make angular components, so something like
https://github.com/Servoy/bootstrapcomp ... rc/textbox

as our bootstrap textbox example.
But this is not in Servoy development but development for Servoy to enhance the things you can do in Servoy.

john1598360627 wrote:
As the wiki says,

Form Component in the Solution Explorer Tree is a special contained form used for simplified design and runtime optimization for the NGClient. The same behavior can be achieved via tabless tabpanel, but form component has optimized display because all elements are part of the same form, taking away the overhead of tabpanel and loading of another form.


So, it's more that it's a form that is embedded into another form. I assume the concept is to like, have a small collection of Servoy Components in this one, such that it can be reused?



yes a form component is a piece of design that can have a few servoy components (like a boostrap label and a bootstrap textbox) together so you can drop it as one thing.

if you drop it then it is part of the form where you drop it on. (you drop it through formcomponent container)


john1598360627 wrote:

What confuses me is, how do I actually change the values of the elements within the form component? And how or where do I set the onAction events?

For Example;

If I have a button in a Form Component, how do I set it's onClick event? Is it on the form it'll be embedded in, like within an onShow or onLoad event?



like normal a normal button that you would drop on the form, you just select the component that is inside the formcomponent (it must have a name)
then you can attach the onclick event of that embedded button to a function of the form where you placed that formcomponent it (through a form component container)

john1598360627 wrote:
Also, how exactly do I display the Form Component? I assume by the FormComponentContainer right? But what exactly does List FormComponent Container do differently?


a FCC adds the form as 1 thing so if the FC would have 1 label and 1 button you drop 1 label and 1 button on your target form, and you get exactly that
the LFC is a repeater of that, so you can reference a foundset to it. an then based on how many rows are in the foundset you get the label and the button repeated (like a table)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: How to Properly Setup a Form Component?

Postby john1598360627 » Mon Jul 25, 2022 11:13 pm

Ahhh ok ok thank you for explaining!

Hmmm, so what is the advantage of using a Form Component over say making a Template and just copy and pasting that template all over the place?

Hm, do Form Components work like Form Extension? Like does updating a Form Component update every instance of the Form Component that appears?
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to Properly Setup a Form Component?

Postby jcompagner » Tue Jul 26, 2022 8:42 am

yes a form component can be updated (like adding a new component, setting some property) an that will be reflected on all forms that use that.
a template is a 1 time copy.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: How to Properly Setup a Form Component?

Postby john1598360627 » Thu Jul 28, 2022 1:02 am

jcompagner wrote:yes a form component can be updated (like adding a new component, setting some property) an that will be reflected on all forms that use that.
a template is a 1 time copy.

Okay, sounds great! I'll have to mess around with it to learn how to use it.
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 5 guests