How to edit and save a reactive form in Angular 2? - javascript

I have built a reactive form, and persisting the data, at initial step I would be saving the form with initial set of data.
for eg:- I have an array of objects as below :
[{Name:'Tom',age:'25',subject:'maths'}].
On saving this to DB, I will be getting a unique ID, Say Student ID.. By using this ID I would need to edit the Data..
Could you please help me how I should be editing the data and save back
P.S., I have a data service where I will be temporarily storing the data and getting the data.

Related

Update a form that is generated dynamically based on api response

I'm building an admin dashboard that has the option to update products. Each product has different attributes. I have already retrieved the data from the API and rendered it but I'm thinking about how I can update it as each product has different properties and I can not know what attributes I will need to update. So my question is how can I manage state and retain all values of the input fields and then post it back to the api.

Use AJAX and Controller to Populate Index page by Dropdown Selection

I have an ASP.Net Core project and I used EntityFramework to scaffold using CRUD. I have my view pages and I want to make my index page dynamic. I have a hierarchical database where it is in this order, Department, SubDepartment, Machine, Equipment, Problem. I have already made queries for different views where I return data based off a dropdown selection. My question is how do I enter queried data into the table to display in Index?
There are many options and I am not sure where to start. Here are some of my thoughts.
Return the queried data to the view as a JSON and sort of manually parse it into the table.
I am not sure on this one but could I just add the queried data into a ViewBag or ViewData and it would automatically be added to the table?
As of now, I already have a JSON that is being returned into the view.
EDIT: I just remembered that ViewBag/ViewData is likely not an option because to my understanding those require a page refresh. So my question now is how can I parse a JSON into a EntitityFramework created table?

Edit in Ember with Ember data an object and its sub-collection in one form

I am working on an application with Ember + Ember Data.
I have a model "Tax" with a collection of "Sub-Regions".
I also created a list of tax objects, with an Edit button. When a user goes to edit, I have created a form, that has fields for the properties of Tax, as well as a list of Subregions with a text input field to modify the default tax rate for the subregion. What I would like to do is to be able to save in one action the object Tax and all the items of the sub-collection. I'm stuck creating that action, not sure how to approach that problem.
I've put a sample here: http://emberjs.jsbin.com/jinovi/6/
I come from a back-end background and I know how I would solve it using MVC with page refresh, but not sure how to do it in Ember.
I've noticed that it gets all saved locally because I'm using Fixtures, I guess that if I use the REST adapter it will work in the server too.
I've put a sample here: http://jsbin.com/jinovi/8/

How can I send back one preset field of data in an HTML form?

I am working on a Node.js website. It maintains data about districts in a province. To edit district data, the admin types the district's name and the year and goes to a form (/edit?district=blah&year=2010) that has various fields about the district. How should I track which district and year the form was filled out for in the POST route's scope?
Basically I want to send back data in the current URL's parameters with a form POST.
Require body-parser module in your node server.. Then u can get the parameters posted in the body like request.body.paramName in any of your routes with post method.
I added ?district=blah&year=2014 dynamically to the action field of my form and it works! I can get the two variables using req.query.district and req.query.year in the POST handler. Another way that people suggested to me was to have hidden input boxes on the page with the data pre-filled (using JS or any templating system you're using) and have it submit with the form.

Storing data in collection forms in Symfony2

Why do they store HTML tags with values in data-prototype instead of storing it just as values?
This leads to big amount of duplicated data.
data-prototype attribute hold the html of collection item. You can get this html, insert in form and you get new collection item. You can`t store it as real html in form cause it would be sended to server spite of the fact that this field can be invisible. You can put it iutside the form using render tag and access later using js.

Categories

Resources