Dynamically creating user objects on the screen


John Clarke
I have an idea regarding dynamically creating user objects on the screen.  Lets say that the screen starts with 1 edit box on it.  Below that edit box is a button that says "Add Edit Box".  When the user presses this button a new edit box is added to the screen.  If the user wishes to add more edit boxes the user just presses this button.How can I achieve this with AppBuilder ?

DecSoft

Hello John,

For sure is not a normal or common task. But, of course is possible, using pure Javascript. And, exactly in the same way that you must to do in an other HTML app. So, if you want to try it and need any particular help, just tell me know.

P.S. Upgrade your AB copy and take a look at the new Dynamic Controls app sample.



Amin Mousavi

Hi Guys,

I am trying to use "Dynamic Controls" sample to create a Dynamic form in AB. I am alright with the PHP API to read the questions from the server and able to handle the HttpClient output but I have troubles getting "Dynamic Controls" element that I copied to my app to work. At the debugger when I hit "Add a new edit" button in the copied elements, it says "'$' is undefined". The rest of the code is working fine, I just cant get to find what is wrong here! Sorry for the silly question, still a newbie in JS and AB. I sense I had to include a JS library or something here but I can not figure how.


DecSoft

Hello Amin,

I have to comments for your question. Firstly, may you no need to create controls dynamically. Certainly we can do it, however, we can consider another possible approach, maybe reducing the input controls to shown, using various app's views to shown various inputs, or use a sole app's view like in the "InputsScroll2" sample.

Please, take a look at the refered "InputsScroll2" sample, which may can be of your interest. On the other hand, I try right now "DynamicControls" sample and works as expected. So, please, send to me your modified sample by email, so I can take a look exactly at the possible error that occur. Then I will try to help you as quickly as possible.

P.S. Please, upgrade your AB copy, Amin, I fix certain introduced bug and add some new app's global variables.



Amin Mousavi

Hi David,

Thanks for your reply, managed to solve the issue, even though the example works very well and I could not see any library included, in my app for some reason after I included the jquery library in the script path in the file manager, it solved the issue.

"InputsScroll2" sample would not fit my case very well. There are number of questionnaires that I need the load in the app, with variable number of questions, if I do not generate them dynamically then I need to build one view per questionnaire while now if I get it done the way I have in mind, it will just work for every scenarios.

Thanks a mill for the offer of looking at my code, I will bother you the next time, managed to fix it this time.

Regards,

Amin 


DecSoft

Hello Amin,

Maybe the problem was with jQuery? That is... maybe your app include an jQuery Javascript file (or URL), but, from some releases ago, App Builder already include jQuery, then, we no need to include it using the app's File manager.

Anyway, just post here in the forum if you find any other problem.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.