如何劫持提交添加值?

时间:2017-03-14 14:45:13

标签: redux-form

我有一个表单,根据用于提交的按钮,可以有不同的状态;一个做一个简单的提交,而另一个添加一个标志然后提交。 我找到了一个非常难看的工作解决方案,所以我想知道怎么做呢?

dict1 = {'renault': 3, 'ford':4, 'volvo': 1, 'toyota': 2} 
dict2 = {}                  # create an empty dict to store the sorted values
for key in sorted(dict1.keys()):
    if not key in dict2:    # Depending on the goal, this line may not be neccessary
        dict2[key] = dict1[key]

1 个答案:

答案 0 :(得分:0)

✅这是惯用的方式。或者,您可以提供initialValues的任意数量的值,这些值在表单上实际上没有Field,但会被提交。