How can i convert Details form into a json in powerapps? - json

'PowerApp->Content'.Run(JSON(DetailForm1,JSONFormat.IncludeBinaryData)
I am trying to put this action on a button but im getting an error
the json function cannot serialise objects of type control
Is there any workaround to this? I want to send data to create a new excel file.

You probably don't want to serialize the form itself, but the updates that the form would send to the data source associated with it. If that's the case, then you can use this expression:
'PowerApp->Content'.Run(JSON(DetailForm1.Updates))
Notice that the edit form control has an Updates property, while the display form control does not. Not sure which type your 'DetailForm1' is, but if it is a display form, you can replace it with an edit form, and set its DefaultMode property to FormMode.View, and that will make it essentially a display form.

Related

HTML form data submitted to embedded mongodb

I want to insert data into a mongodb collection from a HTML Form and I want it to have a specific structure. e.g.
{name:{first_name:"", last_name:""}, address:{street:"",
post_code:""}}
In a normal form submission the data doesn't seem to have structure. Any ideas?
Thanks!
HTML cannot insert into MongoDB directly, you need an application layer, if your application is based on java, you can map the form values into an object of your choice and then save that object in MongoDB.
If you are using nodeJS, it is even easier where you can form the said structure on the frontend and make an ajax call to node server and it can save the passed request as it is into MongoDB.
If you must use HTML form, I think you will have to do the hard work of parsing the HTML data to object of desired structure.

Avoid duplicate values in input tag, type text without javascript in Jinja2

So let's say a user is signing up, and I want to notify them on the fly if they try to enter a username that's already in use.
Since it's jinja2, I can pass the current list of used usernames to the frontend, but how do I then use those without using javascript ?
You can not do that without JavaScript on the client side. But, what you can do is pass the list as a JAvaScript array String to the client and put it into the javascript code to verify the input on the client. For example in a method called by textbox .onblur.

From Form to JSON

I have a HTML form which I want to turn into a JSON to send to a a server. It seems like having a simple mechanism where a the values of a form could be turned into a JSON string would be soemthing that might be in the library, so is there a library to do this?
If you created the form using the Input library, then merge the signals of the form Inputs into one record signal, which you can convert to JSON with the JavaScript.Experimental API.
If you created the form in HTML/JS, there is no need to delegate this task to Elm, just transform the form's DOM to your desired object representation using JavaScript.

Handling multiple forms on a single JSP

I have a JSP page with several forms on it. Some of these forms are
generated dynamically, and each of them submits some information to a
database.
Handling one form is easy, as I can simply make the form post to
itself, and handle the
data using a single bean. Since I have multiple forms, I now have a
problem. Several of the forms on the page handle the same type of data
(same input names), and a 'setproperty *' call for each of the form
beans would change data in several beasn, not just the form/bean that
sent the data.
I am attempting to write a separate JSP with a single bean that
handles a form submission. However, I'm not sure how to make this page
go back to the referring page from which the data was submitted.
i'm going to reformulate in a simple way my question :
I have one jsp, that lists an faq with one question and multiple answers.
Each answer has its comment form, so its the same formbean.
I dont know how to set this...
Use a servlet to control, preprocess and postprocess the request based on the request parameters. You can distinguish the form by the name and/or value of the submit button pressed. You can forward the request back to the JSP page by RequestDispatcher#forward().

Dynamic Dropdown list with actions

like 1 image says more than 1000 words. here is what I want to implement in a django webapp:
http://bit.ly/1ocI0X
Is a dynamic dropdown list with an action to add values to db and dynamicly added to self dropdownlist.
Any hint would be appreciated. Tks.
I'm not very familiar with Django, but as long as you can make ajax calls you're good to go. Using jQuery on the client side would probably make this easier.
If the user selects <New User> from your dropdown, you pop up a form, submit the form with ajax and the response from the server would preferably be json containing the new user's details. Then you insert the json data into your select element.