Hi, All:

 

I wonder if I missed something when I mixed JavaScript code with CFInput
tag. Please see my code below. I placed the "required" and "message" in
cfinput. It works fine. But I need to search the user input string and
find if certain value exists, e.g "something". Since I don't know how to
do it in CF, I created a JS. The problem is that it rolls to the next
page(meaning submits the form) rather than return false. 

 

Has anyone seen such issue or just me missing something?

 

Nathan Chen

 

--------------------------------------------------------

<script language="javascript">

function check ()

{

var e = document.forms[0].s.value.toLowerCase();

 

if (e.match("something") == null)

            {

            alert("You have to type the word SOMETHING.")

            document.forms[0].s.focus();

            return false;

            }           

}

</script>

 

<cfform action="t4.cfm" method="post">

 

<cfinput name="s" size="20" required="yes" message="Please enter
something.">

<cfinput name="submit" type="submit" value=" Go " onClick="check()">

 

</cfform>

--------------------------------------------------------------



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324359
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to