Add dynamically an FormItem to a DynamicForm with SmartGWT - smartgwt

I would like to add a FormItem to a DynamicForm in a SmartGWT form, but all I can find is the setItems method, which adds all FormItem of the form, so it can only be used to initialize the form. Am I missing something?
My form contains a TextItem, and each time the user enters a new string and validate, a new CheckButton is added.

Best approach depends on what you want to do:
Dynamically shown item? Add it to the form at initialization, but hidden, then show() it later
repeating form, like the built-in FilterBuilder component? Just add a series of DynamicForms to a Layout, consider tying them together with a ValuesManager
something else? Consider either #2 above, or, setItems() can be used as a means of providing just one new item to the form, just provide a new Array of FormItems including the items you already have. The form will automatically preserve the item's current values.

Related

How to style an entry in my dynamically created bootstrap table?

I am creating a table dynamically using bootstrap using an ajax call. While displaying the said data, in one particular field, if that field (numeric), does not fulfill a condition, i need it to be highlighted (with say a different color) in the table being displayed. How to do this?

Event for all Controls (Textbox)

I have many textboxes in my form and all of it have keypress.
Is there another way to shorten by code instead writing the code for each texboxes?
Thank You for your Answer.
You can create a subclass (let's call it subTB) of TextBox in which you define the action for keyPressed. Then make your TextBox be instances of subTB instead of instances of TextBox. You have a link to a tutorial in this comment.
Or you can create a function that contains the action to perform when a key is pressed. And the in all your textBox, on the key pressed event, call this function. This second choice will make you also write multiple time the same but this same code will just be a call to the function.

how to set maximum selection of checkbox in a dialog in advanced installer 8.9?

Advanced Installer 8.9
I have 9 check-box on a selection dialog ,on which i need to allow maximum selection of any three check-boxes.
We can show a message box displaying that only three can be selected or disable next button .
Trying to do permutation and combination will be a filthy task,is there any way where i can set a counter which increments on selection of check-boxes.
The easiest way is to create a very simple custom action in C# that checks the value of each property attached with your checkboxes. You need to call this DLL using a published event, from each checkbox, so when a user tries to select it, first the custom action checks to see if other checkboxes are not selected. If there are already 3 checkboxes selected then you need to delete the property of the new checkbox, like this:
session["CHECKBOX_PROP_1"] = "[~]";
Of course you can also use a C++ custom action if you prefer this language.

Rails form select from two options with a button - custom form implementation

I have a website where I want users to be able to select what type of user they are during the registration process.
Specifically, the implementation I want is to have two buttons on the signup page, one called "Seller" and one called "Buyer".
The user should be able to select only one button and once clicked, it should stay highlighted (I know this is just jquery so not the issue).
The selection should be stored in a column in my users model called :type.
It seems pretty straightforward, but the "f.select" form method seems to only implement a dropdown menu, so I am wondering how I can achieve this implementation of two buttons.
Since you're already going to use jQuery, you could add a hidden field for type, create 2 links and style them as buttons, and use jQuery to update the value of type when a user clicks one of the "buttons".

I have a form where i want to add more input fields on button click in MVC View without scripting

I am a newbie, i am trying to create a view where every time i click on add more link next to a Textbox, another text box appears. How do i do that? I searched the same question on this site but i could not find a solution.
You'll have to create an array (string[] Smth)in your model. Then you have to make your "add more" link to submit your form to controller action that will add another element to this array and roundtrip back to view.
You may take a look at the following article which illustrates how you could handle dynamic rows.

Resources