ActionAction.Submit
Action.DirectSubmit
パッケージ: | Ext.form |
定義ファイル: | Action.js |
クラス: | Ext.form.Action.DirectSubmit |
継承元: | Action.Submit |
フォームデータを送信するためのExt.directのサポートを提供します。
この例は、Ext.Directを通ってフォームを送信するためのExt.Directの使用法を説明します。
var myFormPanel = new Ext.form.FormPanel({
// FormPanelの設定。
title: 'Basic Information',
renderTo: document.body,
width: 300, height: 160,
padding: 10,
buttons:[{
text: 'Submit',
handler: function(){
myFormPanel.getForm().submit({
params: {
foo: 'bar',
uid: 34
}
});
}
}],
// 子アイテムに適用される設定。
defaults: {anchor: '100%'},
defaultType: 'textfield',
items: [{
fieldLabel: 'Name',
name: 'name'
},{
fieldLabel: 'Email',
name: 'email'
},{
fieldLabel: 'Company',
name: 'company'
}],
// BasicFormの設定
api: {
// load()リクエストのためのサーバサイドメソッドのコール。
load: Profile.getBasicInfo,
// サーバサイドは submitハンドラに'formHandler'というマークを付けなくてはなりません。
submit: Profile.updateBasicInfo
},
// 渡されるparamsの順番を指定してください。
paramOrder: ['uid', 'foo']
});
サーバーに送られたデータパケットは、何かに似ています:
{
"action":"Profile","method":"updateBasicInfo","type":"rpc","tid":"6",
"result":{
"success":true,
"id":{
"extAction":"Profile","extMethod":"updateBasicInfo",
"extType":"rpc","extTID":"6","extUpload":"false",
"name":"Aaron Conran","email":"aaron@extjs.com","company":"Ext JS, LLC"
}
}
}
フォームは、サーバによって返された次のことと類似しているデータパケットを処理するでしょう:
// successパケットの例 (バッチ処理のリクエスト)
[
{
"action":"Profile","method":"updateBasicInfo","type":"rpc","tid":3,
"result":{
"success":true
}
}
]
// failureパケットの例(1回のリクエスト)
{
"action":"Profile","method":"updateBasicInfo","type":"rpc","tid":"6",
"result":{
"errors":{
"email":"already taken"
},
"success":false,
"foo":"bar"
}
}
同じくExt.form.Action.DirectLoadで議論を見てください。Provides Ext.direct support for submitting form data.
This example illustrates usage of Ext.Direct to submit a form through Ext.Direct.
var myFormPanel = new Ext.form.FormPanel({
// configs for FormPanel
title: 'Basic Information',
renderTo: document.body,
width: 300, height: 160,
padding: 10,
buttons:[{
text: 'Submit',
handler: function(){
myFormPanel.getForm().submit({
params: {
foo: 'bar',
uid: 34
}
});
}
}],
// configs apply to child items
defaults: {anchor: '100%'},
defaultType: 'textfield',
items: [{
fieldLabel: 'Name',
name: 'name'
},{
fieldLabel: 'Email',
name: 'email'
},{
fieldLabel: 'Company',
name: 'company'
}],
// configs for BasicForm
api: {
// The server-side method to call for load() requests
load: Profile.getBasicInfo,
// The server-side must mark the submit handler as a 'formHandler'
submit: Profile.updateBasicInfo
},
// specify the order for the passed params
paramOrder: ['uid', 'foo']
});
The data packet sent to the server will resemble something like:
{
"action":"Profile","method":"updateBasicInfo","type":"rpc","tid":"6",
"result":{
"success":true,
"id":{
"extAction":"Profile","extMethod":"updateBasicInfo",
"extType":"rpc","extTID":"6","extUpload":"false",
"name":"Aaron Conran","email":"aaron@extjs.com","company":"Ext JS, LLC"
}
}
}
The form will process a data packet returned by the server that is similar
to the following:
// sample success packet (batched requests)
[
{
"action":"Profile","method":"updateBasicInfo","type":"rpc","tid":3,
"result":{
"success":true
}
}
]
// sample failure packet (one request)
{
"action":"Profile","method":"updateBasicInfo","type":"rpc","tid":"6",
"result":{
"errors":{
"email":"already taken"
},
"success":false,
"foo":"bar"
}
}
Also see the discussion in Ext.form.Action.DirectLoad.コンフィグオプション | 定義クラス | |
---|---|---|
clientValidation
:
boolean フォームのフィールドが送信される前に、最後にisValidへコールすることで妥当性の確認をするかどうか設... Determines whether a Form's fields are validated
in a final call to isValid prior to submission.
... フォームのフィールドが送信される前に、 最後にisValidへコールすることで妥当性の確認をするかどうか設定します。 falseを渡すことで、フォームはこの確認を防ぐオプションを送信します。 もし定義されない場合、送信前のフィールド妥当性の確認が行われます。 Determines whether a Form's fields are validated in a final call to isValid prior to submission. Pass false in the Form's submit options to prevent this. If not defined, pre-submission field validation is performed. | Ext.form.Action.Submit | |
errorReader
:
Ext.data.DataReader オプション。
JSONは翻訳にerrorReaderを必要としません。
返送されたデータから1つのレコードを読み取... Optional. JSON is interpreted with
no need for an errorReader.
A Reader which reads a single reco... オプション。
JSONは翻訳にerrorReaderを必要としません。 返送されたデータから1つのレコードを読み取るReader。 DataReaderのsuccessプロパティは、送信成功がどのように決定されるかを明示します。 レコードのデータはどんな無効なフォームフィールドにでも適用されるエラーメッセージを提供します。 Optional. JSON is interpreted with no need for an errorReader. A Reader which reads a single record from the returned data. The DataReader's success property specifies how submission success is determined. The Record's data provides the error messages to apply to any invalid form Fields. | Ext.form.Action.Submit | |
failure
:
Function 失敗パケットを受信したとき、またはAjax通信でエラーが発生したときにコールされる関数。
以下は、関数... The function to call when a failure packet was recieved, or when an
error ocurred in the Ajax com... 失敗パケットを受信したとき、またはAjax通信でエラーが発生したときにコールされる関数。 以下は、関数に渡されるパラメータです:
The function to call when a failure packet was recieved, or when an
error ocurred in the Ajax communication. The function is passed the following parameters:
| Ext.form.Action | |
method
:
String リクエストされたURLにアクセスするために使用するHTTPメソッドです。
デフォルトはExt.form.BasicForm... The HTTP method to use to access the requested URL. Defaults to the
Ext.form.BasicForm's method, ... リクエストされたURLにアクセスするために使用するHTTPメソッドです。 デフォルトはExt.form.BasicFormのメソッドとします。もし指定されない場合、基本的なDOMフォームのメソッドとなります。 The HTTP method to use to access the requested URL. Defaults to the Ext.form.BasicForm's method, or if that is not specified, the underlying DOM form's method. | Ext.form.Action | |
params
:
Mixed 渡す余分なパラメータ値です。これらの値は、フォームのExt.form.BasicForm.baseParamsに追加され、フォ... Extra parameter values to pass. These are added to the Form's
Ext.form.BasicForm.baseParams and p... 渡す余分なパラメータ値です。 これらの値は、フォームのExt.form.BasicForm.baseParamsに追加され、フォームのインプットフィールドと共に指定されたURLに渡されます。 パラメータは、Ext.urlEncodeを使用して、標準的なHTTPパラメータとしてエンコードされます。 Extra parameter values to pass. These are added to the Form's Parameters are encoded as standard HTTP parameters using Ext.urlEncode. | Ext.form.Action | |
reset
:
Boolean trueを設定した場合、アクション成功によってフォームがリセットされます。
もし、これが指定される場合... When set to true, causes the Form to be reset on Action success. If specified, this happens
befor... trueを設定した場合、アクション成功によってフォームがリセットされます。
もし、これが指定される場合、successコールバックがコールされる前に、そしてフォームのactioncompleteイベントが発火する前にリセットが発生します。 When set to true, causes the Form to be reset on Action success. If specified, this happens
before the success callback is called and before the Form's
actioncomplete event fires. | Ext.form.Action | |
scope
:
Object コールバック関数がコールされるときのスコープを設定します(コールバック関数のためのthis参照)。 The scope in which to call the callback functions (The this reference for the callback functions). | Ext.form.Action | |
success
:
Function 成功パケットを受信したときにコールされる関数。
以下は、関数に渡されるパラメータです:
... The function to call when a valid success return packet is recieved.
The function is passed the f... 成功パケットを受信したときにコールされる関数。 以下は、関数に渡されるパラメータです:
The function to call when a valid success return packet is recieved. The function is passed the following parameters:
| Ext.form.Action | |
timeout
:
Number failureTypeが
Action.CONNECT_FAILUREとして失敗する前に、サーバレスポンスを待つ秒数を設定します。
... The number of seconds to wait for a server response before failing with the failureType as Action... failureTypeが
Action.CONNECT_FAILUREとして失敗する前に、サーバレスポンスを待つ秒数を設定します。
もし指定されない場合、デフォルトとしてフォームに設定されたタイムアウトを使用します。 The number of seconds to wait for a server response before failing with the failureType as Action.CONNECT_FAILURE. If not specified,
defaults to the configured timeout of the
form. | Ext.form.Action | |
url
:
String アクションが呼び出すURLを設定します。 The URL that the Action is to invoke. | Ext.form.Action | |
waitMsg
:
String アクションを処理されている時間に、メッセージがExt.MessageBox.waitへのコールによって表示されます。 The message to be displayed by a call to Ext.MessageBox.wait
during the time the action is being processed. | Ext.form.Action | |
waitTitle
:
String アクションを処理されている時間に、タイトルがExt.MessageBox.waitへのコールによって表示されます。 The title to be displayed by a call to Ext.MessageBox.wait
during the time the action is being processed. | Ext.form.Action |
プロパティ | 定義クラス | |
---|---|---|
CLIENT_INVALID
:
String フォームのクライアントサイドの妥当性チェックが失敗によって送信アクションを中止するときに返される... Failure type returned when client side validation of the Form fails
thus aborting a submit action... フォームのクライアントサイドの妥当性チェックが失敗によって送信アクションを中止するときに返される失敗タイプです。 clientValidationにfalseが設定されていない場合は、クライアントサイドで妥当性の確認が行われます。 Failure type returned when client side validation of the Form fails
thus aborting a submit action. Client side validation is performed unless clientValidation is explicitly set to false. | Ext.form.Action | |
CONNECT_FAILURE
:
String リモートサーバにリクエストの送信を試みて通信エラーが発生したときに返される失敗タイプです。
レスポ... Failure type returned when a communication error happens when attempting
to send a request to the... | Ext.form.Action | |
LOAD_FAILURE
:
String レスポンスのsuccessプロパティにfalseが設定されている、またはレスポンスのdataプロパティでフィール... Failure type returned when the response's success
property is set to false, or no field values ar... レスポンスのsuccessプロパティにfalseが設定されている、 またはレスポンスのdataプロパティでフィールド値が返されないときに返される失敗タイプです。 Failure type returned when the response's success
property is set to false, or no field values are returned in the response's data property. | Ext.form.Action | |
SERVER_INVALID : String | Ext.form.Action | |
failureType
:
String 検出される失敗タイプはこれらの1つでしょう:CLIENT_INVALID、SERVER_INVALID、CONNECT_FAILURE、LOAD_... The type of failure detected will be one of these: CLIENT_INVALID,
SERVER_INVALID, CONNECT_FAILUR... 検出される失敗タイプはこれらの1つでしょう: CLIENT_INVALID、SERVER_INVALID、CONNECT_FAILURE、LOAD_FAILURE。使用法:
The type of failure detected will be one of these: CLIENT_INVALID, SERVER_INVALID, CONNECT_FAILURE, or LOAD_FAILURE. Usage:
| Ext.form.Action | |
response
:
Object XMLHttpRequestオブジェクトはアクションの実行に使用されます。 The XMLHttpRequest object used to perform the action. | Ext.form.Action | |
result
:
Object boolean型のsuccessプロパティと、他のアクションに特定されたプロパティを含む、デコードされたレスポ... The decoded response object containing a boolean success property and
other, action-specific prop... boolean型のsuccessプロパティと、他のアクションに特定されたプロパティを含む、デコードされたレスポンスオブジェクト。 The decoded response object containing a boolean success property and
other, action-specific properties. | Ext.form.Action | |
type
:
String このアクションのインスタンスが実行するアクションのタイプ。現在、"submit"と"load"のみがサポートされています。 The type of action this Action instance performs.
Currently only "submit" and "load" are supported. | Ext.form.Action |