rails 3.2 check if hidden field has value while sending form - forms

I have inside of a form one hidden field, which must be empty when the form is submitted.
Is any value in it, i want to set a flag in the database column.
How can i realize the check if the value of this hidden field is not filled?
Is it an issue for controllers or for models?

It is an issue for the controller. You want to check the value of that field in the create and update actions and store what ever you want to store there.

Related

How can you perform form validation at form level (not at field level)?

I know you can use a FormTextField to validate user input at the field level, but say you have First Name and Last Name as fields, and you would like to make sure that at least one of them is filled in.
How can you achieve that ?
Thanks.
I'll share what I did in this scenario. I use TextEditingController for these two fields. And after Form is validated I also check these two fields from controllers and if it matches to the condition then I submit values.If it does not, I show an alert dialog.

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!

Keeping two fields in sync when one of them is updated

The application I'm working on is a character based application. there is a field adfc.unme-code in a table and another field arbu.unit-code-shu. These two fields are shown in different windows but they must be in sync. When I update unme-code, unit-code-shu must be updated too.
Is a simple assign statement would be enough or should I do something else? Also, should I use the actual fields or a buffer?
You can use the ASSIGN statement in your code to assign both values at the same time. If there's a possibility of some other process changing those fields, you can create a database trigger procedures on each field to copy the value over to the other field. In the Data Dictionary, view the field properties and click on the "Triggers..." button to do that.
Yes, ASSIGN is used to set the value of a buffers/records field. However: certain critera needs to be met:
The buffer/record needs to be available.
You must have the "lock" of the buffer/record.
If you have the record available and locked you can simply do:
ASSIGN arbu.unit-code-shu = adfc.unme-code.
To make this code "safer" you can simply make sure that arbu is available and not locked by any other user. And finally it will handle if your assign fails because you have no lock at all.
IF AVAILABLE arbu AND NOT LOCKED arbu THEN DO:
ASSIGN arbu.unit-code-shu = adfc.unme-code NO-ERROR.
IF ERROR-STATUS:GET-NUMBER(1) = 396 THEN DO:
MESSAGE "Apparently the record is locked." VIEW-AS ALERT-BOX ERROR.
END.
END.
If you do not have the record (or the right locking) you need to look into your application and see how you can add this feature. What identifies the right record of the second table? A single id? Something else? Are there always a 1 to 1 relation between arbu and adfc etc?
Perhaps your application has a simple way of setting the value of a field. If there is a architecture at place you should try to stick to it...

How to retain the value of an editable text field in a Lotus Notes form every time the user opens it?

I have a form in Lotus Notes containing an editable text field.
Once the user enters a value in that field, it gets saved properly when I check it by opening the document from the back-end.
But I need this value to be seen in the form every time the user opens the form.
Because it is a configuration form where the user should be able to see all the values saved.
For example, a field which contains the path to download a report. And it should be an editable field itself. Is there any way to do this? Any sort of clue or help would be really appreciated. Thanks in advance!
The value of an editable field stored in a document does keep it's value every time the user opens the document.
It sounds like you may ask for something else. You want User A to create a document, enter a value (i.g. a download path) and save the document. When User A or User B later creates another document based on the same form, the previously entered value should be the default. Is that what you mean?
In that case you could simply use #DbLookup or #DbColumn in the formula language in the Default Value property of the field.
Or create a lookup view with the previously created document, sorted descending by date, then use the GetFirstDocument method of the NotesView class to get the first document in that view and read the value out of it using the GetItemValues method of the NotesDocument class.
Performance tip: If you make sure the value you want to look up is visible in the lookup view you can use the GetFirstEntry method of the NotesView class, then use the ColumnValues property to get the value, this is much faster.
Solution is to use #DbColumn in the default value of the editable text field of my form

Multiple values for one field

In GXT I want to create a form where a single field can have multiple values. so once one value is provided user should have option enter another value for the same field, similar to how we attach files in an e-mail.. what is the best way to do this?
One way to provide a button with plus symbol in the form. Clicking that button should add a field to the form dynamically. User can use that field to provide another value.
If you are talking about a single control, which can capture multiple values, can you try Multi-Select field like the one explained in this thread?