i am building a form trying to restrict the numbers (integer) entered based on the previous question which is state.
for example if he choses California hell only be allowed to enter numbers between 1-100 and if he chooses Texas hell only be allowed to enter numbers between 1-200 and so on.
thank you @Kal_Lam, that was very helpful, although i did not consider the range in an excel cell will be that lengthy, apparently not all of my condition can fit in one cell, is there another way to do this maybe by using calculation type
Certainly, you can implement conditional restrictions on the numbers entered in a form based on the previous question (state). To achieve this, you can use JavaScript to dynamically set the constraints for the number input field based on the selected state. Here’s a simplified example using HTML and JavaScript:
htmlCopy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Number Restriction</title>
</head>
<body>
<form>
<label for="state">Select State:</label>
<select id="state" onchange="updateNumberConstraint()">
<option value="California">California</option>
<option value="Texas">Texas</option>
<!-- Add more states as needed -->
</select>
<br>
<label for="numberInput">Enter Number:</label>
<input type="number" id="numberInput" min="1" max="100">
</form>
<script>
function updateNumberConstraint() {
var stateSelect = document.getElementById("state");
var numberInput = document.getElementById("numberInput");
// Set different max values based on the selected state
if (stateSelect.value === "California") {
numberInput.max = 100;
} else if (stateSelect.value === "Texas") {
numberInput.max = 200;
}
// Add more conditions for other states as needed
}
</script>
</body>
</html>
In this example, the updateNumberConstraint function is called whenever the user selects a state. Inside this function, it checks the selected state and dynamically updates the max attribute of the number input field accordingly.
Feel free to adapt this code to suit the specific requirements of your form, and add more states and conditions as needed.