Multiselect Form Field in PDF - multi-select

Using PDF, is it possible to create a single form element with multiple fields of which several can be selected? For example, in HTML, one can create a set of checkboxes associated with the same field name:
<div>Select one for Member of the School Board</div>
<input type="checkbox" name="field(school)" value="vote1">
<span class="label">Libby T. Garvey</span><br/>
<input type="checkbox" name="field(school)" value="vote2">
<span class="label">Emma N. Violand-Sanchez</span><br/>
In this case, the field name is "field(school)", and when the form is submitted, "field(school)" can be supplied 0, 1, or 2 times.
Is there an equivalent construct in PDF where a single field can have multiple values. So far in my investigation, it appears that if fields are assigned the same name, it is only possible to select one field. If it is possible to implement this in PDF, what is this construct called and how can it be implemented?
Edit: To clarify, I am aware that a PDF can contain multiple form fields with different field names, and those can be selected independently, but then the grouping is implicit and not explicit as with the HTML form. I would like to use a construct that makes the grouping of options explicit, and preferably allows for restrictions (e.g. at least one required, no more than 2 allowed, etc).
Edit: If someone can find an authoritative opinion that this is not possible, that would also be a desirable answer.

Yes it is possible. In Adobe PDFs you have the checkbox concept and the radio button concept. While each checkbox and radio button can have its own name, however, they can also be grouped through a subtier via the GroupName.subobj.
Adobe describes it as follows:
The field name. This may include
hierarchical syntax in order to
facilitate logical groupings. For
example, the name myGroup.firstField
implies that the form field firstField
belongs to a group of fields called
myGroup. The advantage of creating
logical hierarchies is that you can
enforce consistency among the
properties of related form fields by
setting the properties of the group,
which automatically propagate to all
form fields within the group.
When the fields are set via a hierarchy you can then get the value of myGroup in this case, and return the selected value of the group. Similarly in the case of RadioButtons you would make sure that all fields in a group have the same name.
This approach to creating form fields
is applicable to all fields, but it
should be noted that radio buttons
require special treatment. Since a set
of radio buttons represents a set of
mutually exclusive choices, they
belong to the same group. Because of
this, the names of all radio buttons
in the same group must be identical.
In addition, the export values of the
set of radio buttons must be set with
a single statement, in which an array
of values are assigned by the
exportValues property of the Field
object. For example, suppose we would
like to create a set of three radio
buttons, each 12 points wide and 12
points high, all named myRadio. We
will place them on page 5 of the
document, and their export values will
be Yes, No, and Cancel. They can be
created as shown in the code given
below:
var name = "myRadio";
var type = "radiobutton";
var page = 5;
var rb = this.addField(name, type, page, [400, 442, 412, 430]);
this.addField(name, type, page, [400, 427, 412, 415]);
this.addField(name, type, page, [400, 412, 412, 400]);
rb.exportValues=["Yes", "No", "Cancel"];

asnyder's response led me to the conclusion that there is no automatic way to handle multiple values within a single field (as one can with HTML). asnyder's examples come from Developing Acrobat Applications Using JavaScript, available from the Acrobat Javascript Developer Center. This document provides some examples of how to manipulate checkboxes, combo boxes, and radio buttons. All of the examples shed some light on the problem and ultimately led me to the conclusion that any system that is using PDF forms will have any multi-selectable groups implicitly defined.
Using the construct of groupName.fieldName appears to be useful to manipulate the widgets as a group (in Acrobat Javascript), but the fields of a group cannot be enumerated (without enumerating all fields and filtering for the groupName), and the collective value of that group cannot be determined without programatically inspecting the values.
In other words, a multi-selectable value is not an intrinsic feature of Acrobat nor of PDF in any substantial way, though it is possible to implement such a form through programming.

Related

Validation rule formula for empty picklist field

I am trying to define a set of actions for a user based on salesforce picklists.
I have a main field called fHCM2__Reason__c that is a picklist containing multiple absence reason types - Sickness, Annual Leave etc
I then have a related field called Annual_Leave_includes_a_trip_abroad__c that is a picklist with two possible options - Yes or No
I want to define that if a user selects "Annual Leave" from the fHCM2__Reason__c picklist they cannot leave the field Annual_Leave_includes_a_trip_abroad__c blank and have to choose Yes or No.
Currently I have the below:
ISPICKVAL(fHCM2__Reason__c, "Annual Leave")
&& ISBLANK(Annual_Leave_includes_a_trip_abroad__c)
My problem with my current method is that because Annual_Leave_includes_a_trip_abroad__c is a picklist, that has "Yes" or "No" options, this is causing an error as I cannot see how to define this in the above PICKVAL() statement.
Can anyone advise how can I state that if a user choose "Annual Leave" then they have to provide a value (Yes or No) for the Annual_Leave_includes_a_trip_abroad__c field if they choose Annual Leave?
The function ISBLANK() takes an expression. A picklist needs to be "unpacked" with TEXT() to be considered an expression. Your validation rule should be:
ISPICKVAL(fHCM2__Reason__c, "Annual Leave")
&& ISBLANK(TEXT(Annual_Leave_includes_a_trip_abroad__c))
Source (see the section on ISBLANK():
If you use this function with a picklist, use ISBLANK(TEXT()) to
convert the picklist items into a text value.
Bear in mind that if you are using this in a custom object (including a custom object that is part of a managed package released by Salesforce, like some parts of Health Cloud), you can use Dynamic Forms to render fields conditionally, and making the field to appear and be required when the right value of the initial picklist is selected, and hidden otherwise.
In general, it's a good idea to avoid creating validation rules when other alternatives that do not stop the users' flow are available.

Input field border in other color for NOT NULL fields

I would like to have the input field border in another color if the underlying field is NOT NULL.
After studying the CakePHP documentation I think I can somehow implement it with the Custom Widgets but how do I get the information if the field is NULL or NOT NULL, or does CakePHP already offer something pre-build which I didn't find?
Update:
I display all tables in the edit mode with one script. With this I want to avoid 50 edit.php scripts serving each table in the database. In this one script I generate on the fly the edit form. This means, this script is NEVER assigned to exactly one table. This is not the problem as I can parse all fields and display them properly for every special database type [date, varchar, set, int, time, ...].
Even the field description is read automatically from the table field comment which is then displayed as title tag when the mouse is moved over the ? symbol.
And now, as the next step, I would like to show a different border for a input field which is NOT NULL. This means, the different border should be shown for all fields which are displayed for the table.
I am using CakePHP 4.1.4
I found this solution:
Due to the fact the function has to evaluate the table schema in order to generate on the fly the form, the function knows which fields are NOT NULL. Then, when it creates the field with $this->Form->control(..) it adds simple in the options argument ["style" => "border: color width type"] for these fields, which are NOT NULL..
If somebody has a more elegant way, please post it as an answer so I can learn something and I'll accept it.

When creating a Drupal 7 content type programmatically, is there a way to add tuples of fields?

In Drupal 7, I'd like to create a Person content type. A person may have multiple profiles - an administrator should be able to select which profile will be considered the primary one. So, that means that I need a tuple consisting of:
A textarea, for the profile text
A checkbox, indicating that this is the primary profile
A textbox, for naming this particular profile
I need functionality to behave like that of any of the lists: I can click "Add another Item", and a set of all three of these fields will appear.
I have a vague idea of how this can be executed, but it involves using the form API to add fields before the form renders each time, as well as the necessary AJAX behavior. This seems a bit overcomplicated, since this would also necessitate creating an additional DB table to hold these tacked-on fields.
Is there a relatively simple way of doing this solely through hook_install()?
You can use drupal.org/project/profile2 or you can complete it using standard Drupal functionality, i.e. create a content type named, let's say, 'myprofile' and add all the fields use need. Then add a nodereferece (http://drupal.org/project/references) field to the user standard profie that would point to your 'myprofile' content type.
So all the 'myprofile' content, created by that user would be his profiles and the one pointed in his standard profile will be his default.
I hope it's clear enough )

Salesforce.com - Custom mini page layout for new Line Item out of price book

I need to programmatically select the fields or values that are shown when I add a line item to an opportunity.
I.E.
If I add a new item of type "A", in the mini page layout, I need to show Fields "X", "Y", "Z". If I add a new item of type "B", in the mini page layout, I need to show fields "X", "Z".
I'm kind of Salesforce newbie. I don't know where to even start. Just a link to the area of documentation that would explain this would be very helpful.
So if I understand correctly, you want the line item related list to show different fields on a row according to a certain field on the line item?
I can't think of anyway to do this with standard functionality, leaving two options I can think of:
Create a custom visualforce page and generated the related list yourself, you can then display different details for each row as it'll be 100% custom — since you're new to the platform I doubt this is will be a particularly viable option.
Use formula fields on the line item to display different values based on the type of a line, then expose these formula fields on the related list.
For example, Forumla_Field_1__c might will use the CASE() function to switch it's output based on one of the fields:
CASE(Type__c, 'A', Field_X__c, 'B' Field_Y__c);
Of course this won't allow you to display a different number of fields on each row, but it will let you see the values you want.
If I've misunderstood, and all line items on a given opportunity will be of the same type, then you'll want to use record types on the opportunity itself, then you can have a different page layout for each record type, and as such, different fields displayed on the related list.

Counting instances of a parameter value on an access form

I'd like to display, in the form footer of a Microsoft Access form, a count of a particular value of a field ("Category") I have tried using
=Sum(IIf([Category]="S",1,0))
as the control source for the text control in the footer, but this fails. I cannot figure out why I cannot perform this calculation on this control/field combination. I suspect it has to do with "Category" not being the control source for any control, even though it's available in the second column of my combo box.
I have performed the count on the "Appliance" field instead, and the sum function works correctly, So I'm pretty sure my general syntax and references aren't completely broken. Both underlying values are text fields.
I'd love some help with how I can get to the second parameter of the query with the Sum function?
Specifics:
ComboBox
Name is "lstAppliance". Bound Column: 1 , Row source :
SELECT qryApplianceDetails.Appliance, qryApplianceDetails.Category FROM qryApplianceDetails;
Text Box
Name is "txtCategory" , Control Source:
=Appliance.Column(1)
In case this isn't clear enough, what I'd like to see looks something like this:
Form header:
Appliance , Category
Form detail
Truck , S
Truck , L
Car , S
Bike , M
House, L
Planet , S
Form footer
Number of "S" things: 3
With this source in the footer:
=Sum(IIf([Appliance]="Truck",1,0))
Displays "2", as you would expect, but:
=Sum(IIf([Category]="S",1,0))
Displays "#error", instead of "3" as I'd expected.
I would try something simpler, but not sure if this will be too simple for what you need.
Use this expression as the control source for txtCategory:
=DCount("*", "qryApplianceDetails", "Category='S'")
Then in the form's On Current and After Update events, add this:
Me.txtCategory.Requery
In regard to the issue of using a field in the form's recordsource in an expression (or in VBA code), since A2000, things have become more difficult. It's not reliable if the field you're using has not been used as the ControlSource of a control on your form. The workaround is to create an invisible control with the field as its ControlSource.
Another way of working around that problem would be to create a control with this ControlSource:
=Val(IIf([Category]="S", 1, 0))
...then Sum() on that control.
I don't like the idea of using a DCount() as it requires a hit on the database for data that's already in the form. Secondly, if this is in a subform, the DCount() would need to be filtered not just on the Category value but also on whatever the link field is between the subform and its parent. It just gets so fussy that I'd say it's better to go with something that can be derived from the recordset already loaded in the form.

Resources