小编gre*_*omb的帖子

在 React Hook Form 中进行验证以确保至少选中一个复选框?

我正在制作一个表单,其中有一部分需要至少选中一个复选框。我正在使用 ReactJS 和 React Hook Form。

这是我的函数中代码的复选框部分render

{/* Checkbox group. User must select at least one medium. */}
<label><b>Medium (check all that apply): *</b></label>
<div>
 <label>
  <input type="checkbox" name="medium" value="Design & Illustration" onChange="validateMedium();"/><span>Design & Illustration</span>
 </label>
</div>
<div>
 <label>
  <input type="checkbox" name="medium" value="Digital Art" onChange="validateMedium();"/><span>Digital Art</span>
 </label>
</div>
<div>
 <label>
  <input type="checkbox" name="medium" value="Drawing" onChange="validateMedium();"/><span>Drawing</span>
 </label>
</div>
<div>
 <label>
  <input type="checkbox" name="medium" value="Painting & Mixed Media" onChange="validateMedium();"/><span>Painting & Mixed Media</span>
 </label>
</div>
<div>
 <label>
  <input type="checkbox" name="medium" value="Photography" …
Run Code Online (Sandbox Code Playgroud)

javascript validation checkbox reactjs react-hook-form

9
推荐指数
1
解决办法
8088
查看次数

收到错误代码:SubscriptionNotFound 消息:尝试获取有关 Azure 虚拟机的数据时未找到订阅?

我当前正在编写一个可访问有关 Azure 虚拟机的详细信息的脚本。这是我到目前为止的代码:

"""
    Instantiate the ComputeManagementClient with the appropriate credentials.

    @return ComputeManagementClient object
"""
def get_access_to_virtual_machine():
    subscription_id = key.SUBSCRIPTION_ID
    credentials = DefaultAzureCredential(authority = AzureAuthorityHosts.AZURE_GOVERNMENT, 
                                        exclude_environment_credential = True,
                                        exclude_managed_identity_credential = True,
                                        exclude_shared_token_cache_credential = True)
    client = KeyClient(vault_url = key.VAULT_URL, credential = credentials)                     
    compute_client = ComputeManagementClient(credentials, subscription_id)
    return compute_client

"""
    Check to see if Azure Virtual Machine exists and the state of the virtual machine.
"""
def get_azure_vm(resource_group_name, virtual_machine_name):
    compute_client = get_access_to_virtual_machine()
    vm_data = compute_client.virtual_machines.get(resource_group_name, 
                                                virtual_machine_name, 
                                                expand = 'instanceView')
    return vm_data …
Run Code Online (Sandbox Code Playgroud)

python azure azure-virtual-machine azure-sdk-python azure-functions

5
推荐指数
1
解决办法
2425
查看次数

ModuleNotFoundError:没有名为“sklearn.externals.joblib”的模块

我正在使用 Python 3,并尝试使用joblib. 我正在尝试导入以下内容:

import sklearn.externals as extjoblib
import joblib
Run Code Online (Sandbox Code Playgroud)

我收到错误: ModuleNotFoundError: No module named 'sklearn.externals.joblib'

我尝试使用 pip3 install sklearn.external --user 但没有运气。有人可以帮我安装这个吗?

installation python-3.x scikit-learn sklearn-pandas

1
推荐指数
2
解决办法
7085
查看次数