Actions

QS

Em validation q/ja: Difference between revisions

From LimeSurvey Manual

(Created page with "'''説明'''")
No edit summary
 
(25 intermediate revisions by 2 users not shown)
Line 3: Line 3:


===質問の検証式 (em_validation_q) ===
===質問の検証式 (em_validation_q) ===


'''説明'''
'''説明'''


This is an equation that is used to validate the entire question (e.g, all of its parts collectively for a multi-answer question). If the question fails the validation criteria, then em_validation_q_tip message will be displayed (it uses the CSS style .error). This tip uses the .em_q_fn_validation CSS style, which is hidden by default within template.css.
質問全体(複数選択質問をまとめて)を検証する式です。検証条件に合致しない場合、em_validation_q_tip で設定したメッセージが表示されます(CSSスタイルは.errorとなります)。このTIPは.em_q_fn_validationというCSSスタイルが使われ、template.cssの既定では非表示となります。


The main difference between this feature and the subquestion validation equations ([[QS:Em_validation_sq|em_validation_sq option]]) is that for this feature, if the question (or question parts) fail validation, then an error message could be shown. For the subquestion validation, each text entry cell (e.g., in an array question type, but it can also be applied to single entry question types) will be styled so that the background color is (light) red.
本機能とサブ質問の検証式([[QS:Em_validation_sq|em_validation_sq オプション]])との大きな違いは、質問または質問の一部が検証エラーとなると、エラーメッセージが表示される点です。サブ質問の検証式では、それぞれのテキスト入力欄(例えば配列質問タイプにおいてですが、単一入力する質問タイプでも機能します)の背景が(薄い)赤色になります。


'''Valid values'''
'''有効な値'''


*Any equation that makes use of the [[Expression Manager|Expression Manager]] syntax, without surrounding curly braces.
*[[ExpressionScript - Presentation/ja|ExpressionScript]]の構文に従うすべての式(中括弧は外す)。


'''Example'''
''''''


*You want to collect demographic information from users via a multiple short text question, and you want to validate that the user has entered a valid email address and phone number.
*自由回答(短い・複数)で利用者の情報を集め、有効なメールアドレスと電話番号が入力されたか検証したいとき


This example shows how the question looks with invalid answers:
この例は無効な回答がいくつかある場合にどのように見えるかを示します。


<center>[[File:validation-invalid-both.jpg]]</center>
<center>[[File:validation-invalid-both.jpg]]</center>


And here is what it looks like with one invalid answer:
これはひとつだけ、無効な回答がある場合の見え方です。


<center>[[File:validation-invalid-phone.jpg]]</center>
<center>[[File:validation-invalid-phone.jpg]]</center>


Here is how you edit a question to enter that information:
これは、情報を入力するためにどのように質問を編集するかを示します。


<center>[[File:validation-gui.jpg]]</center>
<center>[[File:validation-gui.jpg]]</center>


And here is part of the [[Show_logic_file|Show Logic File]] output that lets you check the accuracy of your expression and ensure that there are no syntax errors:
これは、[[Show_logic_file/ja|ロジックファイル]]の出力の一部で、式が正しいか、構文エラーがないかをチェックできます。


<center>[[File:validation-logic.jpg]]</center>
<center>[[File:validation-logic.jpg]]</center>


As you can see, the validation equation tests that both the email and phone number are either empty or match a regular expression filter.
お分かりのように、検証式はメールアドレスと電話番号が空白か正規表現フィルターにマッチするかテストしています。


The validation tip only shows the warning message if the phone or email appears invalid.
電話番号やメールアドレスが無効な場合、検証TIPはワーニングメッセージだけ表示します。


{{Hint|Text=In order to create complex validation messages, read about the usage of the [[Expression Manager]].}}
{{Hint|Text=より複雑な検証メッセージを作成する場合は、[[ExpressionScript - Presentation/ja|ExpressionScript]]の使用方法を参照してください。}}


If you wish to import the example from above into your LimeSurvey installation, download the following .lsq file: [[Media:Em validation q example.zip|Em_validation_q_example.zip]].
LimeSurveyに上記の例をインポートする場合は、この.lsqファイルをダウンロードしてください。[[Media:Em validation q example.zip|Em_validation_q_example.zip]]


{{Hint|Text=Remember, LimeSuvey uses the Perl syntax for regular expressions, so they should start and end with / (slash character)!}}
{{Hint|Text=LimeSuveyは正規表現にPerlの構文を使用しますので
始めと終わりが/(スラッシュ)になります。}}
</onlyinclude>
</onlyinclude>


[[Category:Question Settings]][[Category:Question Logic Options]]
[[Category:Question Settings/ja]][[Category:Question Logic Options]]
 
 
わずかに異なる別の例が下からダウンロードできます。この例は、3つのサブ質問フィールドのすべてを空にはできず、少なくとも1つ(対応する正規表現に従って)記入しなければならないというものです。質問は[[Media:Limesurvey_question_id_question_validation.zip|こちら]]からダウンロードしてください。

Latest revision as of 01:07, 22 May 2020


質問の検証式 (em_validation_q)

説明

質問全体(複数選択質問をまとめて)を検証する式です。検証条件に合致しない場合、em_validation_q_tip で設定したメッセージが表示されます(CSSスタイルは.errorとなります)。このTIPは.em_q_fn_validationというCSSスタイルが使われ、template.cssの既定では非表示となります。

本機能とサブ質問の検証式(em_validation_sq オプション)との大きな違いは、質問または質問の一部が検証エラーとなると、エラーメッセージが表示される点です。サブ質問の検証式では、それぞれのテキスト入力欄(例えば配列質問タイプにおいてですが、単一入力する質問タイプでも機能します)の背景が(薄い)赤色になります。

有効な値

  • 自由回答(短い・複数)で利用者の情報を集め、有効なメールアドレスと電話番号が入力されたか検証したいとき

この例は無効な回答がいくつかある場合にどのように見えるかを示します。

これはひとつだけ、無効な回答がある場合の見え方です。

これは、情報を入力するためにどのように質問を編集するかを示します。

これは、ロジックファイルの出力の一部で、式が正しいか、構文エラーがないかをチェックできます。

お分かりのように、検証式はメールアドレスと電話番号が空白か正規表現フィルターにマッチするかテストしています。

電話番号やメールアドレスが無効な場合、検証TIPはワーニングメッセージだけ表示します。

 Hint: より複雑な検証メッセージを作成する場合は、ExpressionScriptの使用方法を参照してください。


LimeSurveyに上記の例をインポートする場合は、この.lsqファイルをダウンロードしてください。Em_validation_q_example.zip

 Hint: LimeSuveyは正規表現にPerlの構文を使用しますので 始めと終わりが/(スラッシュ)になります。


わずかに異なる別の例が下からダウンロードできます。この例は、3つのサブ質問フィールドのすべてを空にはできず、少なくとも1つ(対応する正規表現に従って)記入しなければならないというものです。質問はこちらからダウンロードしてください。