Create a template using another template - angularjs

I'm trying to create a template which renders a form and then cache that form as template so that I can use it in displaying form with user inputs while in edit.
So far I tried merging both the data (form configuration data+ form input given by user) and render the form. But this won't allow me to cache the form as template and need additional work to retrieve the user input while saving.
Thanks.

Related

angular: creating a simple input dialog box from a form action

Note: I am not well versed with angularjs/frontend dev as such, so I may be using wrong words/terms.
I have a form as a result of a html and a controller. Controller has functions defined which are invoked when user performs some actions as defined in html, like clicking a button.
One of the UI element in the form is ui-select. It enables user to select multiple values from a dropdown.
What I want is that when user clicks on one of the selected value from ui-select, a new dialog window opens up wherein user can provide some input value, close it, return to original open form, and value from dialog box gets appended to the original clicked value from ui-select.
I want to know what is best way of creating an input dialog box in angular.
I see $uibModal being used which can be used to create a form by combining a html and a controller. But I have a usecase for a simple dialog box. So it seems $uibModal is bit of an overkill.
Is there an easier way of doing this?

How to submit multiple forms data all at once in React?

I have 10 components displayed as a side nav list items. Each component is a form (Formik, Material, Yup). When the user clicks on one of the items he goes to a corresponding form page, he can fill out the forms but I want to submit the entire data in a single go (all 10 forms at once).
The problem here is as soon as the user navigates from one form to the other the data get lost. I am not sure how to handle it, any leads?
In my view, if you want to submit all form data in one time you should store all data in 10 forms in their parent component. When the user navigates to other pages, your data will be in the parent component. But I think it's not a good way because the parent component stored a lot of data, it causes poor performance. Why do you want to submit all forms at one time?
Have you thought of storing the form data in a store? Then each form submit updates the value in the store and one final submit gathers all the data into one data form element and submits to the server?

AngularJS: Form validation whereas html is not displayed

I'm developing an application containing several forms, each included in a specific route.
I need to validate all those forms on a global button click. But one form is displayed only, the others don't exist.
How can I process this validation whereas the HTML containing the validation rules (ng-required, ...) is not instantiated?
Thanks.
Vincent.

Inline add/edit/delete data in views in Drupal 7

I am trying to create a content type (say Meter). Each Meter consists of a "Meter Reading". This meter reading content contains three fields, say title, date range and usage. I have a Panel page where I display all the Meter Readings related to a parent Meter. I have displayed the Meter Readings in a tabular format.
I want the user to be able to add new Meter Readings without going to the default Meter Readings creation page. Rather than the default form kind of page, the user should be able to enter the data in the table view provided and it should be automatically saved into the project itself.
So, I want the functionality to be like:-
Display all the meter readings with two links, i.e., Edit and Delete,
When the user clicks on Edit link, the meter reading row should become editable and the user should be able to make the changes inline in the same table,
In the footer there should be a link for adding a new meter reading and when the user clicks on it, a new blank row should be added dynamically to the table and the user should be able to make a new entry into it.
Is there a module in Drupal 7 for doing so?? I have already tried out several modules for this such as SlickGrid, jQGrid and jEditable
Any help would be great. Thanks in advance.
Am afraid am not aware about a module that does all that out of the box. But in case you carry on with custom coding you can have a look at the following:
Edit and Delete options per row in views
Use Views Megarow. For working example you can have a look at how its used in commerce backoffice. Please note that you need to write the form structure ( FORM api ) for the quick edit form in a custom module. The Views Megarow takes care of ajax populating the edit form, its submission in client side, and refreshing the original row after the response from server.
When the user clicks on Edit link, the meter reading row should become editable and the user should be able to make the changes inline
in the same table.
Views Megarow doesn't support inline editing. But another module as suggested by #nmc does it. Its editablefields. But it doesn't have any edit/delete button. You click on the text directly ( provided user has appropriate permission to edit the field data ) in view.
In case you are going to use editablefields, then you would have to add another delete button in view, which one confirmation would redirect to the page that triggered delete action.
Since delete button would redirect to a default confirmation page, you may want to code a custom delete action which may override this.
In the footer there should be a link for adding a new meter reading and when the user clicks on it, a new blank row should be
added dynamically to the table and the user should be able to make a
new entry into it.
I suggest creating a small ajax form. Create a "Add Meter Reading" button in it, which on submission would create a meter reading node in the server. The ajax form should have parent information in a hidden field ( i.e. the Meter id). The ajax response for this form could be another script to load/refresh the view on client side.
Client side code to refresh the view can be found in Views Autorefresh submodule in Views Hacks.
If using views megarow you would have to add another jquery function on ajax response after view is refreshed - Trigger edit button.
Otherwise you may have to add some classes or theme to newly created rows in view to bring them to focus.
It is important that the entire views refreshes, so that drupal behaviours are attached to the newly created entry in table.
I don't know if there is one module which will meet all your needs but you may be able to use some in combination.
Views Bulk Operations (VBO) - has Drupal 7 support
This module augments Views by allowing bulk operations to be executed
on the displayed rows. It does so by showing a checkbox in front of
each node, and adding a select box containing operations that can be
applied. Drupal Core or Rules actions can be used.
editablefields - Drupal 7 version in dev
This module allows CCK fields to be edited on a node's display (e.g.
at node/123), not just on the node edit pages (e.g. node/123/edit). It
also works within views etc. Anywhere a 'formatter' can be selected,
you can select editable (or click to edit).
editview - no Drupal 7 support yet but I thought I would mention it in case you're able to adapt the code yourself
Editview is a plugin for the Views module. It allows you to create a
view in which the nodes are editable, and new nodes can be created.

Salesforce - Populate text are from drop down selection

I have a picklist with three values and a text area that has three values as well, but I would like to correlate one value from the picklist with one value of the text area. Any thoughts as on how I can do this?
If creating a visualforce page is an option, you can do this with a controller extension, or a custom controller. For example, you could override the save() method and have your new save code populate the text for you-- simply create a map of dropdown values to text area content and set the text as desired. It should also be possible to do this without saving by using some of the visualforce built in AJAX hooks: look at the onchange attribute. (Note that last I checked the onchange did not fire properly for lookups, but it may work for dropdowns)
Have a look at the visualforce documentation here: http://www.salesforce.com/us/developer/docs/pages/index.htm

Resources