Formio: Pre Filled Form (Dynamic Value) - formio

Problem for: Formio (Community Edition)
Say this is my form
1. Backend will dynamically fill up the first field
2. User will fill up the rest of the fields
I could't find a way Formio does this, so I did something like this.
1. Generate a submission
2. Assign values
3. Assign owner
4. Now I can give this link to the user for filling
Problem:
1. Now If i have any mandatory validations, then it does not let me start a submission from the backend.
Is there a way to fix this or a work around?

Related

find if collection not exists in mongoDB

I have a case where i have 5 forms. And user have to fill 1st, 2nd, 3rd and 4th form and every form has it's different collection(table). And in 5th form, I am displaying some fields from 1st, 2nd, 3rd and 4th form by calling GET API.
Actually, I am showing the list of 5 forms to user. User can click on any form from first 4 forms and then fill it. When user clicks on 5th form then i am calling an api to get first 4 forms fields.
Now my question is: As i am calling api in 5th form to get data from first 4 forms. If a user fill only first form, and leave other forms and clicked on 5th form as only 1st form collection exists but 2nd, 3rd and 4th form collection is not exists. So, How to handle this situtation?
can your clearify more what you want to return if 2nd..4th form is empty ..
From my point of view, you are storing forms in array or object.
If you want check empty form in get api then implement checks like
if(arr[2]==" ")
or object sendond index is empty and so on for other form(index)
Or you want to implement in post API if any form is empty then keep in input field as required or check all form value while posting form.
The solution that comes in my mind is First you should not allow the user to fill next forms if he does not fill the previous forms, you can track this by js click function and you can also add the all data in the same collection but if you want to place it in different collections still its ok.
One thing that i want to ask is how do you track that the same user filled the previous forms ? if you are tracking it by id then its easy
just when you make a api call check that if the data exist with this user name in the previous table collection then show the data else display a message to fill the previous forms first

Increment Id in Sharepoint

I am trying to increment an Id in a Sharepoint list.
I have tried different settings in the online editor of Sharepoint under "Settings > List Settings > Edit Column > Calculated Value".
Another option I tried was to create a custom add form using InfoPath.
In this custom form, I added a rule on my field contactId. The rule has two actions.
Create a Query to the Contacts table
Set the current Id equal to (the maximum idContacts + 1)
enter image description here
A thirth option I tried is to set a rule under Submit options. That way I thought when I submit my form it will check if idContacts is currently blank. It will Query the Contacts table, set the current idContacts as the (maximum idContacts + 1) and finally submit the data to my table.
enter image description here
Finally When I submit my form it gives a pop up message "Connecting to Server" then it redirects to my list but nothing is added to the list.
Does anyone know what my problem could be. Or does anyone know a proper way to do this. I already lookup up a lot of tutorials and other information but I can not find it.
Thank you in advance!

Getting current item ID in SharePoint Infopath form

Can we get the current item ID value while submitting the data in InfoPath form.
I need to use this and concatenate the ID with other field value. Tired "Max(#ID) + 1" function but it wouldn't solve the problem.
I know it can be done using calculated column or workflow.
It needs to be done using InfoPath form ? Is it possible ?
You already figured it out yourself. Im assuming you are trying to use the ID in naming it.
Create a blank field.
Then add that field to your submission naming concat.
Create a receive data connection (assuming you havent) to that library.
On the Submit rule add the query action to that library and a set field action to set that new blank field with max(ID) + 1. Make sure Submit action is last.
That should do it unless Im missing something as I have used this many times!

Yii, form using 2 models -> skip the validation on one

I have one form using to different models. I want to be able to create a new Person and eventually a new User, to give this person an account. A person doens't need to have a User related (could be just a person used for statistics or something like that). I have a checkbox in my form "Click if you want create a user" and I show the user part of the form if it's checked.
Then in the controller I can, with the checkbox value, know if I need call performAjax() for both Person and User or only Person.
But my problem is about the client validation. If I try to submit the form without the User required field, for example, the submition will abort and i'll get some errors like "This field is requiered".
So, my question is how could I skip the validation of my user model if its fields are empty (checkebox unchecked, we don't want to create a user).
Any help are welcom :)
Sorry for my bad English.
Have a good day :)
Michaƫl S.
When saving the model, set the first parameter on false to skip validation:
$model->save(false)

Symfony 1.4 Form Creater

Need: Ability to dynamically build Forms
Structure (simple idea not actual structure)
Admin: Form Assignment, where you create what field you want your new Form to have
FrontEnd: Where the New form will be implemented (this is the root of this question)
FronEnd Storage: When the New form is filled out the data points are written to a set of tables
The idea is simple enough, Go into Admin, select the fields, fieldType, and Labels you want
I.E.
Field Name:*Enter a specific field name, like f_name or email
FieldType: [Text, TextArea, Password, Radio, DatePicker, CheckBox, Select, etc]
Label: What to display on the resulting form, f_name = First Name, etc
Then I hit a page on the FrontEnd where the New form is generated, I fill it out and voila the data is stored in the FrontEnd Storage tables.
So the question is, idea's on how to accomplish this, I already have the Admin section done, it's dynamically building and appropriately binding a frontEnd From that I would like advice on.
Currently my idea is to simply make a shell form that is a huge ugly switch statement that builds sfForm elements and appropriate validators for each field (fields given from what was entered in the Admin area)
I feel this is the 'wrong' way to do it, I did find a plugin 'spyFormBuilderInterface2Plugin' which is old and build for propel not doctrine, but this is the basic idea of what I am after. So how would YOU do it?
Please note I am not looking to Dynamically ADD forms to a current form, I can already do this and it's exactly what is implemented in my Admin section, I need to take data a create a whole NEW form programatically
I've created something like you described, just the way you said.
I have a model FormDefinition which defines a form, and has a collection of FormFields. Each form field has a widget_class, widget_options, validator_class and validator_options.
I have a custom myForm which needs a FormDefinition in it's constructor. In the setup() of myForm, I loop through all fields a instantiate the widgets and validators.
Beacuse in our solution, we needed/wanted to store all form data in separate tabels. My myForm extends from sfDoctrineForm, and my backend has some logic which creates/updates the (php) model and database definition, by just calling the appropriate Doctrine methods. But you could also create an EAV store.