FAQ: I want to get the value of a read-only item using a script.
## Answer
Get it with ".text()".
---
## Overview
In Pleasanter, read-only items are composed of span tags (usually input tags). Due to the specifications of the jQuery library that can be used in "[Script](/en/manual/table-management-script)", values can be obtained by using ".val()" for items composed of input tags and ".text()" for items composed of span tags. Therefore, even if you use the sample script code in the official Pleasanter manual or FAQ, which assumes normal input tags, you may not be able to obtain values for read-only items, so please read accordingly.
### When An Item With A Unit Set Is Made Read-only
When a numeric item with a unit set is made read-only, the unit will be included in the display, and ".text()" will retrieve the value with the unit. If the unit is not required, add a process to delete the unit as appropriate.
## Sample Code
1. This is a sample that outputs the read-only values of Title, Category A, and Date A in a message when the editing screen is opened.
##### JavaScript
```
$p.events.on_editor_load = function () {
$p.setMessage(
'#Message',
JSON.stringify({
Css: 'alert-success',
Text: `The title of this record is "${$p.getControl('Title').text()}", its classA is "${$p.getControl('ClassA').text()}", and its dateA is "${$p.getControl('DateA').text()}". `
})
);
}
```
2. This is a sample that outputs only the value of read-only numeric value A (with unit setting) in a message when the editing screen is opened.
##### JavaScript
```
$p.events.on_editor_load = function () {
$p.setMessage(
'#Message',
JSON.stringify({
Css: 'alert-success',
Text: `The number A of this record is "${$p.getControl('NumA').text().replace('day','')}". `
})
);
}
```
## When Using A Server Script
When using a [Server Script](/en/manual/table-management-server-script), you can get values in the "[model](/ja/manual/server-script-model)" object regardless of whether the item is input-enabled or read-only. Even if the item is read-only and has a unit, only the value is retrieved in the "[model](/ja/manual/server-script-model)" object.
## Related Item
<div id="ManualList"><ul><li><a href="/en/manual/table-management-script">Table Management: Script</a><span>08.13.2024 up</span></li>
<li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/server-script-model">開発者向け機能:サーバスクリプト:model</a><span>08.22.2023 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />