LijaHarris
2 years agoQrew Cadet
Code Page: Javascript Function Prompt or Alert
Hi,
I have a code page where users can input their information and it goes directly into QuickBase in Javascript and HTML. Our clients were wondering if a prompt could be given to users if they entered in a non-valid zip code. Here is what I have so far but it is not working. As can be seen below, the fid is 16 of the field users input their zip code into. Zip Code is my list the client gave me (well a couple examples). Is it the OnChange that is not working (On the Form:)? I would like the promp to ideally happen oninput instead since its a input field. For reference inputzip would be what the user inputs. That could also be incorrect possibly and there's another way to get the user's input:
<script lang="javascript">
function CheckForZip
{
var zipcode = [94602,95616]
var inputzip = "<field fid='16'>" + $("input[name=_fid_16]").val() + "</field>";
if (zipcode.includes(inputzip)) {
alert ('yes');
}
}
On the form:
<tr><td style="font-family: Sans-serif;" class=m>Zip Code:*</td>
<td class=m><input type=text size=60 onChange=CheckForZip name=_fid_16 ></td></tr>
------------------------------
Lija Harris
------------------------------
I have a code page where users can input their information and it goes directly into QuickBase in Javascript and HTML. Our clients were wondering if a prompt could be given to users if they entered in a non-valid zip code. Here is what I have so far but it is not working. As can be seen below, the fid is 16 of the field users input their zip code into. Zip Code is my list the client gave me (well a couple examples). Is it the OnChange that is not working (On the Form:)? I would like the promp to ideally happen oninput instead since its a input field. For reference inputzip would be what the user inputs. That could also be incorrect possibly and there's another way to get the user's input:
<script lang="javascript">
function CheckForZip
{
var zipcode = [94602,95616]
var inputzip = "<field fid='16'>" + $("input[name=_fid_16]").val() + "</field>";
if (zipcode.includes(inputzip)) {
alert ('yes');
}
}
On the form:
<tr><td style="font-family: Sans-serif;" class=m>Zip Code:*</td>
<td class=m><input type=text size=60 onChange=CheckForZip name=_fid_16 ></td></tr>
------------------------------
Lija Harris
------------------------------