how to create different UI components every times in runtime and save their contents into database and save the UI which created on the page? - oracle-adf

Dears
good day
I need your help for the following case:
The activity nature of the client is very dynamic
Need to have a dynamic form (he wants to create many form every day by himself in runtime). And add some components in the runtime.
He doesn't have a standard form so he need every day to create new form
For example he can make today a form with group of input text and group of check box and table and tomorrow he need to make a new form with input text and radio and table also etc..,.
In addition he needs to achieve and save it into database to use it and retrieve it later , and he wants to save every form with its UI contents which he created in runtime to be able to view it later on the jsf page.
So he want to save created form contains data into database
And also he wants to arrange the component on the page by his own way
And I putted this case in OTN :
https://community.oracle.com/message/14356236#14356236
How could I do it?
Regards

You can find a series of blog posts of Andrejus, right here:
http://andrejusb.blogspot.co.uk/2015/09/adf-12c-dynamic-forms-with-adf-bc-ui.html

Related

Multiple Steps Form in React

I was asked to develop a multi-step form in React. The form contains 30 fields to be filled and it should be displayed in 3 steps of 10 fields each.
The first 2 steps have "Save" and "Next step" options to save the current work or continue with the next step.
The final step has "Save" and "Finish form" options, both of them will save the form in the database (through a web service).
Something like this:
The project is made on React, using Mobx for the state management, and I'm new to react. My question here is... how should i manage the states and the stores?
Should i have a single Store (FormStore) with the 30 fields and pass it to each component through the props and they will fill each field?
Is there any way i can have a single store (like a singleton) and each component fills its fields there?
I have to manage the fields information in memory untill the Save button is hit. And if when the Save button is hit, i need to save just the filled fields.
Any kind of guide will be appreciated.
If this form data is not changed anywhere else in your application, you can use a single store for all. I cannot think of any disadvantage given that it is relatively small.
You would want to split it if the answers could be put in different categories and different categories would be mutated by different functionalities of your app.

React router - different content if post in list vs own page

React router has very cool feature: if you have a list of items (Instagram for example) and if you click on one item, content opens in modal/overlay but if you copy-paste the link to new tab/window or share the link with a friend for example, it opens in its own page.
I would love to use this feature but I need to find a custom solution..
My posts are very data heavy
I've split posts data into 2 tables in database
1st is very lightweight containing essential data: 4-5 columns
2nd table is very heave, ~30 columns
When user uses search filter, list updates only with data from 1st table
If user clicks on post, it will open in a modal/overlay
I will recycle the data I already have (from 1st table) and also get rest of the data from 2nd table
However, when user shares the link or opens it in new tab/page, data from 1st table is not present. I would need to integrate a conditional logic:
If post opens in list view (modal/overlay), only get additinal 2nd table data
If it's opened in a new tab/window in its own page, get all the data, 1st table included
How could I integrate this with React router? Has anyone already tried it? This would also allow to use different layout/components when user opens item in page view. Is there a way to check it?
Or is there a flaw in my logic? I imagine list would update very fast because it doesn't require huge amount of data and also would modal/overlay because it recycles some of the data.
I read all the docs, also searched online - didn't find anything.
Modals in react router are great. I've used the pinterest example and adapted it to my own needs.
Ensure you do your check on state.modal===true in a master layout component to give you the modal styling.
you'll need to check if table 1 stuff is present in your state and dispatch an action to trigger the async call in componentDidMount. You should be fetching table 2 in all scenarios.

Is there a way to quickly add a new row of fields on a visulforce page?

I am trying to create a incident log in safesfore. The key aspect is that everything can be added on the same page reducing the amount of clicks that have to be made. There are 6 fields i have created:
Date Opened, Date closed, incident, reported to, reported by and notes.
I was wondering if there is a way to create an "add new" button that will create another row of the fields i have just lised. The idea being that the page does not refresh it is all done in real time.
Many thanks
You'll need a custom Visualforce page implementation.
There are 2 ways to do it
1) Building a list of records on apex and iterate over that list displaying the fields on the front end (vf page apex:repeat)-- Then when the button "add new" is clicked you'll append an empty record to the list and re-render the apex:repeat to reflect the changes.
This is good because you don't need a lot of boilerplate code since the records with be binded with the backend. However, the rerendering can lead to some performance issues in my experience.
2) Build a custom Javascript implementation, where you have an in memory collection and using DOM manipulation add/remove rows of the list. When the user saves the data from memory must be sent using JSON and a VF Remoting method can perform the JSON parsing and saving the rows.
Both are valid, the first is good to avoid boilerplate but the second is much faster (but you need to write some boilerplate).

Sales-force Custom Object Edit page layout and Button

We have a custom object say Sales form. On edit apge of customer object we need to add a button Save and Add Product(similar to One we can have on Opportunity page). User forget to add Product/SKU after saving the sales form
New Button(Save and Add product), will save the sales-form first and then depends on record type will open the related list(child object).
Say a Sales form is for Custom Program, after save,. it will open up Custom Program relate list.
If Record type is of Price Change Notification it willl open up related list of SKU detail..
Is this possible, please adivse, we have 9-10 different record type, and we don't want to re-write the application with visualforce and all customization. Re-writing with Visualforce page has some pitfalls.
As far as I'm aware, you can't replace the Save button as it's part of the Edit page and not the standard layout, so to achieve this with one button you'd need to write a custom visualforce page, this need not be complicated though — a simple custom controller which uses a standardController for management of the record would suffice.
You would call Save on the StandardController and then return a different page redirect based on the record type, the page itself would pretty much only consist of an <apex:detail> tag. If you want more details I can provide more.
If you really don't want to write any custom code or pages then you'll need to do this as a two step process, i.e. use the standard page and then have a custom "Continue" button which takes the user onto a custom URL based on the record type. I've just created a contrived version of this by doing the following:
1 - Define a custom formula field on the object, this should be of type text and can use a CASE() statement to determine the URL which the user will be taken to when hitting the button (note that this was made just for the sake of an example so it forwards to the accounts standard page for the record type 'Friend' and contacts page for 'Foe').
CASE($RecordType.DeveloperName, 'Friend', '../001/o', 'Foe', '../003/o', '')
Note the reason I use a formula field here instead of the doing this in the custom button is that for some reason you can't seem
access the record types by name when defining a custom button.
2 - Define a custom button for the object called "Continue" or something similar that makes sense for you. For my example I just used the Contact object, so I referenced the custom field on my record and specified the options shown here:
3 - Customise the page layouts used by your record types to include this new button and you should be done!

asp mvc, best solution to store user input data before it will be saved to database

for example i've got a form with some input fields(every form and it's inputs with validation rules are stored in database).
Every input got it's own OnChange() which posts json (i.e. new value, input element name, ...) to controller for validation, if validation passes the new value must be saved somewhere until user clicks submit button, which will save all data to database table.
And here i'd like to ask, what this special place between ui and database can be ?
p.s.
also if user closes browser/form the next time he'll come back i need to ask him if he would like to start from an empty form or fill form with values he previously entered there.
Thank You !
Cookies or intermediary database table would work for this case.
for an intermediary database like that, you could use something like MongoDB, it is really easy to get it started, you just work with the classes you have, don't need to setup any schema, you just save the objects
http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial
If you are submitting the entire form at the end, why can't you just store the values at that time? Is this a multi-page form(s)? Why not allow the database records to be partially filled? You could always add a bit column to mark the record as complete or incomplete. This would be much simpler than duplicating your table structure.

Resources