-1
用於異步驗證字段值這是我怎麼設置我的終極版形式無法檢索的終極版形式
import React, { PropTypes } from 'react';
import { reduxForm, Field } from 'redux-form/immutable';
...
const asyncValidate = (values, dispatch, props) => {
// print out the value for inspection
console.log(`>>>> ${values.coupon}`);
}
...
const CheckoutForm = reduxForm({
form: 'Checkout',
asyncValidate,
})(cardDetailsForCheckoutForm);
我想驗證該字段名爲coupon
。我需要以異步方式驗證它,因爲它需要在服務器端進行檢查。不知何故,我無法獲得優惠券價格爲values.coupon
。它只是返回爲undefined
但根據示例(http://redux-form.com/6.0.0-rc.1/examples/asyncValidation/),我應該能夠檢索該值。爲什麼失敗?
您可能只是想刪除您的問題 – Bergi
我認爲它有一定的價值。我花了很長時間來追查它。 –