সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি টেক্সট ইনপুট ক্ষেত্র একটি স্ট্রিংকে এর মান হিসাবে এবং একটি স্ট্রিং এর পাঠ্য হিসাবে সংরক্ষণ করে। এটির মান সর্বদা একটি বৈধ স্ট্রিং, যখন এটির পাঠ্যটি এটির সম্পাদকে প্রবেশ করা যেকোনো স্ট্রিং হতে পারে।
টেক্সট ইনপুট কনস্ট্রাক্টর একটি ঐচ্ছিক মান এবং একটি ঐচ্ছিক যাচাইকারী নেয়। মান একটি স্ট্রিং কাস্ট করা উচিত. এটি null বা undefined হলে, একটি খালি স্ট্রিং ব্যবহার করা হবে।
JSON সংজ্ঞা আপনাকে বানান পরীক্ষা বিকল্প সেট করার অনুমতি দেয়।
সিরিয়ালাইজেশন এবং এক্সএমএল
JSON
একটি পাঠ্য ইনপুট ক্ষেত্রের জন্য JSON দেখতে এরকম দেখাচ্ছে:
{"fields":{"FIELDNAME":"text"}}
যেখানে FIELDNAME হল একটি স্ট্রিং যা একটি টেক্সট ইনপুট ক্ষেত্রের উল্লেখ করে এবং মান হল ক্ষেত্রে প্রয়োগ করা মান। মানটি কনস্ট্রাক্টর মান হিসাবে একই নিয়ম অনুসরণ করে।
এক্সএমএল
একটি টেক্সট ইনপুট ক্ষেত্রের জন্য XML দেখতে এরকম দেখাচ্ছে:
<fieldname="FIELDNAME">text</field>
যেখানে ক্ষেত্রের name বৈশিষ্ট্যে একটি স্ট্রিং রয়েছে যা একটি পাঠ্য ইনপুট ক্ষেত্রের উল্লেখ করে এবং ভিতরের পাঠ্যটি ক্ষেত্রে প্রয়োগ করার মান। অভ্যন্তরীণ টেক্সট মান কনস্ট্রাক্টর মান হিসাবে একই নিয়ম অনুসরণ করে।
কাস্টমাইজেশন
বানান পরীক্ষা
ক্ষেত্রটি তার ইনপুট পাঠ্য বানান পরীক্ষা করে কিনা তা সেট করতে setSpellcheck ফাংশন ব্যবহার করা যেতে পারে।
বানান পরীক্ষা সহ এবং ছাড়া পাঠ্য ইনপুট ক্ষেত্র
বানান পরীক্ষা ডিফল্টরূপে চালু আছে।
এটি পৃথক ক্ষেত্রে প্রযোজ্য। আপনি যদি সমস্ত ক্ষেত্র পরিবর্তন করতে চান তাহলে Blockly.FieldTextInput.prototype.spellcheck_ বৈশিষ্ট্য পরিবর্তন করুন।
একটি পাঠ্য ইনপুট যাচাইকারী তৈরি করা হচ্ছে
একটি টেক্সট ইনপুট ক্ষেত্রের মান হল একটি স্ট্রিং, তাই যেকোনো যাচাইকারীকে অবশ্যই একটি স্ট্রিং গ্রহণ করতে হবে এবং একটি স্ট্রিং, null বা undefined প্রদান করতে হবে।
এখানে একটি যাচাইকারীর একটি উদাহরণ যা স্ট্রিং থেকে সমস্ত 'a' অক্ষর সরিয়ে দেয়:
[null,null,["2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eA text input field stores a string value and allows user text input, with the value always being a valid string.\u003c/p\u003e\n"],["\u003cp\u003eYou can create text input fields using JSON or JavaScript, customizing them with options like spellcheck and validators.\u003c/p\u003e\n"],["\u003cp\u003eText input fields can be serialized and deserialized using JSON or XML, representing the field name and value.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esetSpellcheck\u003c/code\u003e function allows control over individual field spellchecking, while \u003ccode\u003eBlockly.FieldTextInput.prototype.spellcheck_\u003c/code\u003e affects all fields.\u003c/p\u003e\n"],["\u003cp\u003eValidators for text input fields accept a string and return a modified string, null, or undefined to enforce specific input rules.\u003c/p\u003e\n"]]],["Text input fields store a string as both their value and text, with the value always being a valid string. Creation involves defining the field in JSON or JavaScript, specifying a default text and optional spellcheck. The constructor and JSON allow setting a value, defaulting to an empty string if `null` or `undefined`. Serialization uses JSON and XML, where field names and values are stored. Spellcheck can be toggled, and validators are functions that accept and return strings, `null`, or `undefined`.\n"],null,["# Text input fields\n\nA text input field stores a string as its value and a string as its text. Its\nvalue is always a valid string, while its text could be any string entered into\nits editor.\n\n#### Text input field\n\n#### Text input field with editor open\n\n#### Text input field on collapsed block\n\nCreation\n--------\n\n### JSON\n\n {\n \"type\": \"example_textinput\",\n \"message0\": \"text input: %1\",\n \"args0\": [\n {\n \"type\": \"field_input\",\n \"name\": \"FIELDNAME\",\n \"text\": \"default text\",\n \"spellcheck\": false\n }\n ]\n }\n\n### JavaScript\n\n Blockly.Blocks['example_textinput'] = {\n init: function() {\n this.appendDummyInput()\n .appendField(\"text input:\")\n .appendField(new Blockly.FieldTextInput('default text'),\n 'FIELDNAME');\n }\n };\n\nThe text input constructor takes in an optional value and an optional\n[validator](#creating_a_text_input_validator). The value should cast to a\nstring. If it is `null` or `undefined`, an empty string will be used.\n\nThe JSON definition also allows you to set the [spellcheck](#spellcheck) option.\n\nSerialization and XML\n---------------------\n\n### JSON\n\nThe JSON for a text input field looks like so: \n\n {\n \"fields\": {\n \"FIELDNAME\": \"text\"\n }\n }\n\nWhere `FIELDNAME` is a string referencing a text input field, and\nthe value is the value to apply to the field. The value\nfollows the same rules as the constructor value.\n\n### XML\n\nThe XML for a text input field looks like so: \n\n \u003cfield name=\"FIELDNAME\"\u003etext\u003c/field\u003e\n\nWhere the field's `name` attribute contains a string referencing a text input\nfield, and the inner text is the value to apply to the field. The inner\ntext value follows the same rules as the constructor value.\n\nCustomization\n-------------\n\n### Spellcheck\n\nThe\n[setSpellcheck](/blockly/reference/js/Blockly.FieldTextInput#setSpellcheck)\nfunction can be used to set whether the field spellchecks its input text or not.\n\n### Text input fields with and without spellcheck\n\nSpellchecking is on by default.\n\nThis applies to individual fields. If you want to modify all fields change the\n`Blockly.FieldTextInput.prototype.spellcheck_` property.\n\nCreating a text input validator\n-------------------------------\n\n| **Note:** For information on validators in general see [Validators](/blockly/guides/create-custom-blocks/fields/validators).\n\nA text input field's value is a string, so any validators must accept a string\nand return a string, `null`, or `undefined`.\n\nHere is an example of a validator that removes all 'a' characters from the\nstring: \n\n function(newValue) {\n return newValue.replace(/a/g, '');\n }"]]