changeRuleset()

The changeRuleset() function (client-side) modifies a single answer attribute for the current configuration session. Answer attributes mainly correspond to fields on the answer record.

Syntax

Use this syntax for the changeRuleset() function:

            changeRuleset({
    type: string,  
    parent: string,
    code: string,  
    attr: string,  
    value: string
}); 

          

Parameters

Note:

All properties are required.

The changeRuleset() function accepts a single object as a parameter. The object includes the following properties:

  • type - Takes 'answer' as a value.

  • code - Specifies the answer code.

  • parent - Specifies the parent question code.

  • attr - Specifies the answer attribute.

  • value - Specifies the value of the answer attribute.

Answer Attributes

The attr property specifies the answer attributes to update. The following table lists all available attributes. Unless otherwise specified, fields belong to the answer record.

Attribute

Description

acode

Code field on the answer record

code

Question and answer code (Q/A)

colconf

Select Product Table Columns field

customVars

Custom Variable field

desc

Description field

dtype

Input Box Answer Type field

filter

Product Table Filter field

filterBarConf

UI Popup Table Filter field

filterByValue

Allow search before loading field ('T' | 'F')

format

Date Format field

hasText

Add text field field ('T' | 'F')

hasTextArea

Add text box field ('T' | 'F')

hide

Hide label field ('T' | 'F')

hrule

Hide Rule field

image_url

Image URL field

incompatibleMessage

Incompatible Rule Message field

inlineHtml

Custom HTML field

inputFilter

Input Filtering field

inputLabel

Input Group Label field

inputLabelR

Show input group label on the right field ('T' | 'F')

inputVisible

Always show text field or box field ('T' | 'F')

labelHtml

Label field

labelOnly

Show label only field ('T' | 'F')

mapColumnQA

Mapping to Questions/Answers field

mapRowQA

Mapping JSON Rows to Question/Answer field

mapqa_clear

Clear mapped questions/answers on reset field ('T' | 'F')

mapqt

Target QTable field

mapqt_clear

Clear qTable before mapping field ('T' | 'F')

mapqt_opt

Mapping to QTable field

name

Name field

pickIgnoreReadOnly

View when read-only field

pickMulti

Allow multiple selection field ('T' | 'F')

picklistCustOpt

Popup List Options field

qcOptions

QTable Dropdown List Options field

qcellType

QTable Column Type field

qcode

Question Code field

qtype

Question Type field

rorule

Read-only Rule field

seq

Sequence Number field

showPlaceholder

Show label as placeholder field ('T' | 'F')

span

UI Columns field

tbl

Reference Table field (string)

tblid

Reference Table field (internal ID)

tooltipHtml

Tooltip field

url

Image field

Examples

The following examples show how to use the changeRuleset() function.

Changing the Placeholder Field Value

This example changes the placeholder text for the answer with the code FUEL_TYPE. This answer belongs to the question with the code ENGINE.

              changeRuleset({
    type: 'answer',
    code: 'FUEL_TYPE',
    parent: 'ENGINE',
    attr: 'placeholder',
    value: 'Enter text here'
}); 

            

Adding a Text Area to a Checkbox

This piece of code adds a text box to the answer with code CHECKBOX_1. This answer belongs to the question that has QUESTION_A has a code.

              changeRuleset({
    type: 'answer',
    code: 'CHECKBOX_1',
    parent: 'QUESTION_A',
    attr: 'hasTextArea',
    value: 'T'
}); 

            

Related Topics

General Notices