Accessing form elements filling fields? - vxml

I have a form which has an initial element, I am running a check using the confidence feature to check for other phrases that might match the user's input. If there are then i am going to a menu, from here i am asking the user to input a dtmf value to say whether one of these values where correct. If the user selects an option, i want it to fill that field of which it checked, with that interpretation or possibly go to another form which does the same thing, if i choose to do it using the other form, can u access filled fields from another form?
regards

According to the VoiceXML Specification the scope for that type of variable would only be accessible in the form. But you can assign the values to another variable before leaving the form that has document scope (i.e. defined just below the vxml tag). Or even give it global scope by defining the variable in the root document, which makes it accessible to the whole application.

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.

Is it possible with an ADF ComboBox component to type in values not present in the given LOV?

I am working on an input form using ADF. I have an input field in which I want to show a list from which the user can select the value and also require a type option in case the value user want is not in the list.
I use the JDeveloper 12.2.1.3 for development. I have tried using ADF ComboBox component based on a static list. The component gives a list a expected. But I cannot type in a new value in case the value I wanted is not in the list. I can only type whatever is in the list already.
I am looking for something similar to the HTML input-datalist combination which gives a list and allows type if the intended value is not in the list.
The InputListOfValues and other LOV components only allow you to enter data which is present in the list. That is the way these components are designed. It would not make sense to allow other input as you normally use such components in places where you want to make sure the user can only input reference data defined in other data.
Anyway, it's easy to create some kind of component which allows you exactly what you want. I wrote a blog n this here https://tompeez.wordpress.com/2013/02/03/jdeveloper-11-1-1-6-0-afinputtext-with-self-made-look-up-not-using-lov/
From this page you can download and run the ADF Faces Rich Client Demo, which shows all components and what they do.

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 )

Making Related Models Optional

I have a form where a user can enter a location address as well as the utility companies that provide service to that address. The Utility data is associated to the building:
Location hasMany Utility
Solely within the context of the utility, the name field is required so there's validation indicating as much. Within the context of a location, though, any utility information is optional. The user can choose not to enter that data when entering a location which would simply indicate that they don't want to associate the location with any or all of the utility companies we track.
Using the FormHelper, though, the validation is detected and the field gets marked as required. I want to retain that validation for the instances where utility data is being entered independently, but remove the required indicator on the location form.
I know I can hack this in any number of ways (e.g. removing the required class via javascript, etc.), but I'm wondering if there's a clean way to do this using the Cake API. I haven't seen anything obvious, so I'm hoping someone else has been here and found a clean, simple solution.
Thanks.
You can either ask the user how many utilities they want to add before creating the form, or you can add the Utility record inputs dynamically using js (the later is more work to do, and not as error-proof as the former).
An example of the view (if you want to do it in 1 view):
if (empty($this->data){
// a form to ask how many utility records the users want to create.
}else{
// generate the form based on user input.
}
I assume you know what to do in the controller.
I would add a class to the form element that are optionnal, and use that class to override the "required" indicator.
In fact there is a Cake solution, use the error param
$this->Form->input('Model.field', array('error' => false));
To disable error message output set the error key to false.

Multiselect Form Field in PDF

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.

Resources