Getting at form meta-data for an Access form that is not loaded - forms

How do I get at the information for an Access form that is NOT loaded? (Loaded forms are pretty easy - via UserForms, but I specifically want something that will address a form whether or not it is loaded)

You can access the information for all forms (loaded or not) via the CurrentProject.AllForms collection:
Dim frm As Form
Set frm = Application.CurrentProject.AllForms("FormName")
'' print out the Record Source for the form
Debug.Print frm.RecordSource

Well, UserForms aren't part of Access, I am assuming you are talking about VBA userforms like those available in Excel VBA IDE, but these aren't part of the Access VBA implementation (for the obvious reason that Access has it's own forms). Also, the code that Gord shows won't run because the AllForms property is a collection of AllForm objects which aren't the same as the Access Form object, and they don't have the RecordSource property.
But, to answer your question, you can use the AllForms collection to see if a particular form is loaded. If it is you can check any info you want directly. If it isn't you can load it but keep it hidden, then you can check any info you want to.

Related

What is the best way to create a form with a confirmation page?

I would like to create the following form:
Step 1: The user enters his contact details.
Step 2: A confirmation page, where the user has the possibility to confirm or edit his entered data again (back to step 1)
The contact details are stored in an entity domain object. The properties have annotations for validation.
My problem:
When I pass the contact object to the confirmation page, I get the message
Could not serialize Domain Object Vendor\Extension\Domain\Model\Object. It is neither an Entity with identity properties set, nor a Value Object.
I understand that I cannot pass a non-persistent domain object. A tip I found was to convert the object to an array and back again later. This works to display the input on the confirmation page. But if the user edits the data, I lose the validation functionality when converting to an array.
Another possibility would be to persist the object already after step 1 (temporarily?) . The problem here is that the data must not be displayed in the backend (they are not yet confirmed). In addition, unused data is created if the user cancels the process.
Is it possible to save objects temporarily?
What is the most elegant solution to this problem?
If you only wan't to create a form, why don't you use a form plugin like Ext:form or Ext:powermail? These have a summary page by default. And you have the possibility to write the entered data into you're database.

Token is not getting a value when the form sent by email

I'm developing a basic recruitment-type website.
I have an "Apply" CustomForm attached with a contenttype("Job"), but I can't get access fields outside of the CustomForm widget. I'm trying to add the reference number or the url to the email within the workflow. Orchard shows {Content.Fields.Input-Reference} token, but it returns no value when used.
Should I overwrite the handler when the form is created or how can I access fields of other zones?
As far as I understand the question, you don't actually need to add a custom token to your module. Custom Forms module takes care of that for you and adds the tokens for fields itself. You just need to use them in the email module.
Just look for a tokens named like this:
Content.Fields.[FormContentTypeName].[FieldName]
Not that the tasks of adding custom tokens to the system and accessing them inside the workflow are particularly hard, mind you.

SugarCRM - Close access to records based on a value?

I'm building a custom module in SugarCRM Community Edition, I have everything set up as i'd like (almost).
In my Module i have a checkbox marked 'Processed' what i'd like to achieve is that when this checkbox is marked, the users who are 'sales agents' and not 'admins' can no longer view this record.
They need to be able to have access to the record up until the point it's marked as processed. Is this possible?
Yes, look at /modules/Employees/views/view.list.php in listViewProcess() to see how the list view always filters out users based on the status value. You would do something similar for your module to filter out Processed. Then if you need to also ensure that they can't access the record directly make sure to take care of the edit/detail views as well. In both view.detail.php and view.edit.php (or in the module's controller) check for Processed being set and if so (and perhaps not an admin or some other user type) display a "This record is already processed" message and/or do a redirection.

Web2py form field options

I am using web2py forms and i want to have some fields only visible to user (as fixed which cannot be edited). I tried making various combinations of editable, writeable, readonly but was of no use. I looked into web2py book too but that also seems insufficient. It would be great if someone can tell me how to do this.
You mean some fields visible to all visitors and some fields visible only if logged in?
If that's the case, then build your form conditionally:
form_fields = [
Field('pubfield'),
Field('pubfield2')
]
if auth.user: # This is true if the end-user is logged in and you're using the built-in auth
form_fields.append(Field('private_field'))
return dict(form=FORM(form_fields))
Unless you're not talking about logged in users, and just want to make the fields be visible, but not editable. Then, use writable=False like you tried, but I think you have to either use crud.create/crud.update or SQLFORM / SQLFORM.factory (the latter does not require a data model)
SQLFORM.factory(Field('my_readable_field', writable=False))
If you the form is based off of a database, you can use CRUD (you'll need to modify the settings for CRUD if you're not using authentication, so that CRUD forms are accessible)
crud.create(db.some_table)
or
SQLFORM(db.some_table)

how to set read only properties to the particular info path form control based on user logged in?

how to set read only properties to the particular info path form control based on user logged in?
Your best option (assuming you are using managed code) is to get the user name with either Application.User.UserName or HttpContext.Current.User.Identity and then call IsInRole (I believe it is a member of the WindowsPrincipal class).
Save the result into the value of a field and you can then use the standard conditional formatting to lock the fields you don't want the users changing. I also usually conditionally change the look of those readonly fields (grey background fill etc) so the users don't get confused and think they can edit.