# SSNEditText

Provides a user interface element that represents a Social Security Number (SSN).

### Set field name <a href="#set-field-name" id="set-field-name"></a>

Sets the text to be used for data transfer to VGS proxy. Usually, it is similar to field-name in JSON path in your inbound route filters. It is highly important to specify this parameter because the VGSCollect module relies on it too.

Warning: You must set up `fieldName` in other way input field will be ignored by VGSCollect.

{% tabs %}
{% tab title="XML" %}

```xml
<com.verygoodsecurity.vgscollect.widget.SSNEditText
    android:id="@+id/ssnField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:fieldName="ssn_field_name"/>
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val ssnField = findViewById<SSNEditText>(R.id.ssnField)
ssnField.setFieldName("ssn_field_name")
```

{% endtab %}

{% tab title="Java" %}

```java
SSNEditText ssnField = findViewById(R.id.ssnField);
ssnField.setFieldName("ssn_field_name");
```

{% endtab %}
{% endtabs %}

### Define the required state <a href="#define-the-required-state" id="define-the-required-state"></a>

Specifies whether the text inside input field is required to be filled.

When `app:isRequired` set as `true`, then input data should be valid only. If `app:isRequired` set as `false`, then input data will be valid in case the field is empty. Otherwise input data should be valid.

By default, a widget is required.

{% tabs %}
{% tab title="XML" %}

```xml
<com.verygoodsecurity.vgscollect.widget.SSNEditText
    android:id="@+id/ssnField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:isRequired="false"/>
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val ssnField = findViewById<SSNEditText>(R.id.ssnField)
ssnField.isRequired(false)
```

{% endtab %}

{% tab title="Java" %}

```java
SSNEditText ssnField = findViewById(R.id.ssnField);
ssnField.isRequired(false);
```

{% endtab %}
{% endtabs %}

### Define number group divider <a href="#define-number-group-divider" id="define-number-group-divider"></a>

To set the symbol that will divide groups of digits in the number add `app:numberDivider` to your field's declaration in xml. By default, Collect SDK adds `-` character as divider symbol.

{% tabs %}
{% tab title="XML" %}

```xml
<com.verygoodsecurity.vgscollect.widget.SSNEditText
    android:id="@+id/ssnField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:numberDivider="-"/>
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val ssnField = findViewById<SSNEditText>(R.id.ssnField)
ssnField.setDivider('-')
```

{% endtab %}

{% tab title="Java" %}

```java
SSNEditText ssnField = SSNEditText(R.id.ssnField);
ssnField.setDivider('-');
```

{% endtab %}
{% endtabs %}

Also, **VGS Collect SDK** gives an ability to change or to remove divider symbol before it has been submitted to the Proxy.

To set the symbol that will divide groups of digits in the number add `app:outputNumberDivider` to your field's declaration in xml. By default, **Collect SDK** adds `-` character as divider symbol.

Info: `app:numberDivider` and `app:outputNumberDivider` should contain only one character.

{% tabs %}
{% tab title="XML" %}

```xml
<com.verygoodsecurity.vgscollect.widget.SSNEditText
    android:id="@+id/ssnField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:outputNumberDivider="-"/>
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val ssnField = findViewById<SSNEditText>(R.id.ssnField)
ssnField.setOutputDivider('-')
```

{% endtab %}

{% tab title="Java" %}

```java
SSNEditText ssnField = findViewById(R.id.ssnField);
ssnField.setOutputDivider('-');
```

{% endtab %}
{% endtabs %}

### Additional XML attributes <a href="#additional-xml-attributes" id="additional-xml-attributes"></a>

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Attribute</strong></td><td><strong>Description</strong></td></tr><tr><td><pre><code>app:numberDivider
</code></pre></td><td>Sets the symbol that will divide groups of digits in the number. This divider will be visible to user in `SSNEditText` field.</td></tr><tr><td><pre><code>app:outputNumberDivider
</code></pre></td><td>Sets the symbol that will divide groups of digits before submit to the Proxy.</td></tr><tr><td><pre><code>app:inputType
</code></pre></td><td>Set the type of the content with a constant as defined for input field.</td></tr><tr><td><pre><code>app:imeOptions
</code></pre></td><td><p>Specify soft input method for the input method action. By default, the system uses a</p><pre><code>actionNext
</code></pre><p>Plain textor</p><pre><code>actionDone
</code></pre><p>Plain textaction.</p></td></tr><tr><td><pre><code>app:fontFamily
</code></pre></td><td>Default font family (named by string or as a font resource reference) for the text.</td></tr><tr><td><pre><code>app:fieldName
</code></pre></td><td>Sets the text to be used for data transfer to VGS proxy. Usually, it is similar to field-name in JSON path in your inbound route filters.</td></tr><tr><td><pre><code>app:isRequired
</code></pre></td><td>Specifies whether the text inside input field is required to be filled.</td></tr><tr><td><pre><code>app:textSize
</code></pre></td><td>Size of the text.</td></tr><tr><td><pre><code>app:ellipsize
</code></pre></td><td>If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle.</td></tr><tr><td><pre><code>app:ellipsize
</code></pre></td><td>If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle.</td></tr><tr><td><pre><code>app:text
</code></pre></td><td>Text to display.</td></tr><tr><td><pre><code>app:textColor
</code></pre></td><td>Text color.</td></tr><tr><td><pre><code>app:maxLines
</code></pre></td><td>Makes the View be at most this many lines tall.</td></tr><tr><td><pre><code>app:minLines
</code></pre></td><td>Makes the View be at least this many lines tall.</td></tr><tr><td><pre><code>app:textStyle
</code></pre></td><td>Style (normal, bold, italic) for text.</td></tr><tr><td><pre><code>app:cursorVisible
</code></pre></td><td>Makes the cursor visible (the default) or invisible.</td></tr><tr><td><pre><code>app:gravity
</code></pre></td><td>Specifies how to align the text by the view’s x- or y-axis when the text is smaller than the view.</td></tr><tr><td><pre><code>app:scrollHorizontally
</code></pre></td><td>When the text is allowed to be wider than the view (and therefore can be scrolled horizontally).</td></tr><tr><td><pre><code>app:hint
</code></pre></td><td>Hint text to display when the text is empty.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.verygoodsecurity.com/vault/developer-tools/vgs-collect/android-sdk/ssnedittext.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
