← 返回 stripe 的题目列表Create a UI Component for Passport Validation
类型:online_judge
stripe
Problem Description
Design and implement a UI component to validate passport number formats for different countries. The component includes a country selection dropdown and a passport input field.
Requirements
Display a country dropdown, allowing users to select a country.
An input field for entering the passport number.
Use the provided phoneNumberFormat object to validate the passport number format for different countries.
Implement error handling logic to inform users of incorrect input formats.
Ensure good accessibility and consider how to refactor and optimize the code.
Input
From standard input, containing a JSON formatted phoneNumberFormat object and user's input data.
Output
Print the formatted passport number or an error message.
Test Cases
If phoneNumberFormat specifies that a country's passport number is 8 digits, print an error if the user inputs a different format.
Data Scale
phoneNumberFormat object will contain format information for up to 100 different countries.
Example
Input
{"US": {"length": 8}}
{"country": "US", "passport_number": "12345678"}