In the August 08 release we have provided the ability to make Feedback and Marketing content more dynamic. By allowing the pass through of certain attributes from question and form field tags into the personalized content we have provided an avenue which when paired with custom JavaScript will support a number of new use cases.

The question/field types and the allowable attributes are as follows:

Text type questions.

Form fields displayed as textbox (email, first_name, last_name… any custom field of type text field, text area, integer, ).

-onselect

-onchange

-onblur

-onfocus

-disabled

Choice type questions displayed as a Menu or a List.

Any form field displayed as a menu (country, province, any custom field of type menu, date, or date time).

-onchange

-onfocus

-onblur

-disabled

Choice type questions displayed as Radio or Checkbox.

Any form field displayed as a radio or checkbox (opt-ins, any custom field of type Opt-in or Yes/No).

-onclick

-onblur

-onfocus

The following pages contain a few specific use cases. There are obviously a multitude of scenarios that could be realized with this functionality which won’t all be covered.

Use Case 1: I want to populate a custom form field based on the results of a survey question. Basically, I want this to show up as an attribute of the contact but I also want the overall reporting capabilities of survey questions to gauge the overall response of my audience.

Example Implementation:

-Create a Choice type Survey Question (display as Menu) with the appropriate choices

-Create a corresponding contact menu type custom field with the same choices

-Create a survey and choose to ‘Add HTML Content’. Add something similar to the following:

  • Note: You will do this by adding the question on the Design Tab, then switching Source to pass in the appropriate attributes

<rn:question onchange="if (this.value == 53) {_main.wf_2_39.value = 25;} else if (this.value == 54) {_main.wf_2_39.value = 26;} else if (this.value == 55) {_main.wf_2_39.value = 27;} " question_id="12" split="False">Favorite Color</rn:question>

<div style="DISPLAY: none">

<rn:field checkbox="false" required="false" field_id="39" tbl="2">hidden form field</rn:field>

</div>

-Explanation:

  • What we have done here is to create a hidden form field which will have the appropriate value set depending on what the user chose in the survey question.
  • Our form on the page is always named _main and all form fields follow the naming strategy of wf_2_$id where $id is either the custom field id or the assigned integer value (can be found in documentation) if this is a default contact field. The integer values referred to correspond to custom field menu item integer id’s which can be determined by adding the form field to the survey, previewing the survey, and then viewing the source (or you can write a report to see the ids from the menu_items table).
  • this.value refers to the values of the question_choice choice_id. These can be determined by adding the question to the survey, previewing the survey, and then viewing the source (or you can write a report to see the choice_id for that question).
  • When the user submits the survey there will be stats kept for the survey question for the entire survey as well as there being the specific value stored on the contact record for each contact.

Use Case 2: Same as Use Case 1 except that I want to do this for a text type question as opposed to a choice type. Therefore, I want the text entered by the user to populate a hidden text type form field which will update the contact record in the database.

Example Implementation:

-Create a Text type Survey Question

-Create a corresponding text type custom field

-Create a survey and choose to ‘Add HTML content’. Add something similar to the following:

  • Note: You will do this by adding the question on the Design Tab, then switching Source to pass in the appropriate attributes

<p>

<rn:question question_id="21" split="False" onchange="_main.wf_2_40.value = this.value">comments</rn:question>

</p>

<div style="display:none;">

<p>

<rn:field checkbox="false" required="false" field_id="40" tbl="2">commenter</rn:field>

</p>

</div>

-Explanation:

  • What we have done here is to create a hidden form field which will have whatever text value input by the user.
  • Note that you should restrict the size of the survey text question to be the same as the custom field you are using.
  • Our form on the page is always named _main and all form fields follow the naming strategy of wf_2_$id where $id is either the custom field id or the assigned integer value (can be found in documentation) if this is a default contact field.
  • When the user submits the survey there will be stats kept for the survey question for the entire survey as well as there being the specific value stored on the contact record for each contact.

Use Case 3: I want to disable a text type question until a prior question has been answered on the page. It doesn’t make sense to accept an answer to the text type question if they do not answer the choice type question above. I know I can do this within the Feedback product with branching if these questions are on different pages but I want everything on one page.

Example Implementation:

-Add both the Text and Choice type questions to the survey via ‘Add HTML Content’

-Modify the markup from the Source tab to look something like the following:

<p>

<rn:question disabled="disabled" onclick="if(this.value == 70) {_main.q_11_11.disabled=false}" split="False" question_id="17">tech support solve

</rn:question>

</p>

<p>

<rn:question split="False" question_id="11" disabled="true">Service Comments</rn:question</p>

-Explanation:

  • What we have done here is set the disabled property on the text type question to true by default. In this case, the choice type question above will have to be set to a certain value before the textbox is enabled.
  • Note that we used the ‘onclick’ event which means the choice type question must be displayed as a radio or checkbox.
  • Our form on the page is always named _main and we are enabling a text type question which is named q_$question_id_$question_id

Use Case 4: I want to hide a form field until the customer has specified that the field is necessary. As an example, I don’t want to ask them for a phone number unless they have checked the box saying that they would like to be contacted via the phone.

Example Implementation:

-Add a Yes/No custom form field (displayed as checkbox) to the document and have a question like ‘Would you like us to call you when your order is shipped?

-Insert a hidden div with a form field which will be used to collect the phone number.

-Write JavaScript which will allow the div to be hidden or displayed depending on the events that occur. The below is an example from the Internet as opposed to being code supported by RightNow Technologies.

<html xmlns=" xmlns:rn="

<head<title>phone</title<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /</head>

<body<form rn:webform="true">

<p>Would you like us to call you when your order is shipped? <rn:field checkbox="true" required="false" field_id="41" tbl="2" onclick="ShowContent('hiddenPhone')">call_on_phone</rn:field</p>

<div id="hiddenPhone" style="display:none;"<p>Please enter a number you can be reached at: <rn:field checkbox="false" required="false" field_id="100015" tbl="2">Office Phone</rn:field</p>

</div>

<p<input id="submit_btn" type="submit" value="Submit" name="submit_btn" rntsubmit="true" />

</p>

<script type="text/javascript" language="JavaScript"<!--

function HideContent(d) {

if(d.length < 1) { return; }

document.getElementById(d).style.display = "none";

}

function ShowContent(d) {

if(d.length < 1) { return; }

document.getElementById(d).style.display = "block";

}

function ReverseContentDisplay(d) {

if(d.length < 1) { return; }

if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }

else { document.getElementById(d).style.display = "none"; }

}

//--</script</form>

</body>

</html>