Password:
Re-enter Password:

[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => eastinq [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 13 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => drmaves [ip] => drmaves@iglide. [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 14 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> CFFORM Validation trumping Custom Form Validation - Macromedia ColdFusion

CFFORM Validation trumping Custom Form Validation - Macromedia ColdFusion

Is there any way for custom form validation to work in concert with the cfform validation? I have a custom script that compares the values of two select boxes which works just fine when useing the <form> tag. Once I switch that over to use some of the <cfform> validation, my OnSubmit value in the <cfform> tag is rewritten on parsing to be the CF validator. Thus my script does not get run. Any ideas beyond doing all the validation in the custom script? Thanks....

  1. #1

    Default CFFORM Validation trumping Custom Form Validation

    Is there any way for custom form validation to work in concert with the cfform
    validation?

    I have a custom script that compares the values of two select boxes which
    works just fine when useing the <form> tag. Once I switch that over to use some
    of the <cfform> validation, my OnSubmit value in the <cfform> tag is rewritten
    on parsing to be the CF validator. Thus my script does not get run.

    Any ideas beyond doing all the validation in the custom script?

    Thanks.

    Beals Guest

  2. #2

    Default Re: CFFORM Validation trumping Custom Form Validation

    See the topic titiled "CFMX 7 javascript validation in CFform does not work" in this same forum. This sounds like the same problem.
    IowaDave Guest

  3. #3

    Default Re: CFFORM Validation trumping Custom Form Validation

    Not quite the same issue, but thanks. I'm on the latest build of 6.1 & the
    CFIDE directory is mapped properly (had THAT issue a while back).

    Basically I'm looking to find out whether the automated validation CFMX
    provides can coexist with something that I write myself because the instant the
    form is changed to cfform, anything you had in the onSubmit parameter is
    overwritten with what CFMX needs to call the automated validation.



    Beals Guest

  4. #4

    Default Re: CFFORM Validation trumping Custom Form Validation

    Actually, I'm having the same problem you are, not with the CFIDE directory.
    My custom JavaScript will not coexist peacefully with the <cfform> script,
    either. As soon as I add onSubmit="return checkform();", it messes up both
    sets of scripts so that I have zero validation. This problem didn't exist with
    6.1.

    IowaDave Guest

  5. #5

    Default Re: CFFORM Validation trumping Custom Form Validation

    How did you get it to work under 6.1?
    Beals Guest

  6. #6

    Default Re: CFFORM Validation trumping Custom Form Validation

    I'd like to know also... interested in having my own javascript coexist and still maintain the same error handling look and feel, etc.

    -weStside
    WestSide Guest

  7. #7

    Default Re: CFFORM Validation trumping Custom Form Validation

    I didn't get it to work under 6.1, I was wrong. Turns out I never had it
    working. If you're going to use <cfform>, you can't add your own onSubmit.
    It's a major bummer.

    onValidate is an option with <cfinput>, but not with <cfselect>

    A kind forum writer wrote on another posting a way to get around the new
    <cfselect> as follows:

    <cfselect name="School"
    query="getSchools"
    value="SchoolID"
    display="School"
    selected=""
    width="125"
    size="1"
    queryPosition="below"
    required="yes"
    message="You must select a school!"
    label="School:">
    <option></option>
    </cfselect>

    This got me through my form so that it looks halfway decent and it works with
    all of my inputs.

    Because of its inability to include your own onSubmit, I believe you'll still
    want to do some forms without using Flash. Sorry I don't have a better answer
    for you. If it's a simple form, you can't beat the new Flash version, its
    obviously a much nicer user experience.

    Dave

    IowaDave Guest

  8. #8

    Default Re: CFFORM Validation trumping Custom Form Validation

    Hi,

    I can validate <cfselect> fine, no issue with that. Were you having an issue
    with that? If so, I have a solution for that...

    I am trying to make one field required based on the selection of another field.

    Do you know of a way to do this?

    thx

    -Westside

    WestSide Guest

  9. #9

    Default Re: CFFORM Validation trumping Custom Form Validation

    It's beyond my talents - haven't been doing this long enough. I do know of
    some cheats, such as the MX Collection available from [url]www.interaktonline.com[/url].
    This sounds exactly like what they're doing with their "Conditional Regions"
    in html forms. It'll cost you a little change for that answer and I'm guessing
    it wouldn't work with the new Flash forms.

    IowaDave Guest

  10. #10

    Default Re: CFFORM Validation trumping Custom Form Validation

    I solved this problem by adding my custom JavaScript validation function to the
    actual SUBMIT button at the bottom of the form using the "onClick" attribute.
    In this way, I was able to validate my TwoSelectsRelated via the SUBMIT button
    click, and once that was validated, the subsequent form data was validated via
    the CFINPUT generated JavaScript.

    Hope this helps.

    <DNoe>

    Guest

  11. #11

    Default Re: CFFORM Validation trumping Custom Form Validation

    Very good, Dnoe, nice job! It seems like people always find a way... I'll have to give that a try.

    Have a great day!

    Dave
    IowaDave Guest

  12. #12

    Default Re: CFFORM Validation trumping Custom Form Validation

    I tried what you suggested but still seem to be having problems.

    Here's what I had to execute my custom validation before using CFFORM
    validation:

    <cfform action="relocation-act.cfm" method="post" name="visit" onSubmit =
    "return ValidateForm('visit')">

    Here's what I tried base upon your suggestion:

    <input type="submit" value="Request Relocation Information" class="button"
    onClick = "return ValidateForm('visit')">

    I also removed - onSubmit = "return ValidateForm('visit')" - from the CFFORM
    tag.

    It still ignores the custom validation. What am I doing wrong?



    drmaves Guest

  13. #13

    Default Re: CFFORM Validation trumping Custom Form Validation

    In the onSubmit event, you have to call the CF validation script before calling
    your custom script. The CF validation is built with this naming convention:

    _CF_checkmyfrm(this)

    Where "myfrm" is the name of your FORM object.

    Here is how I incorporate CF validation with custom validation:


    <html>
    <head>
    <title>Untitled</title>
    <script language='JavaScript'>
    <!--
    function check_pw()
    {
    if ( doent.myfrm.PW1.value != doent.myfrm.PW2.value )
    {
    window.alert("Passwords do not match...");
    return false;
    }
    return true;
    }
    //-->
    </script>
    </head>
    <body>

    <cfform name="myfrm" action="validation2.cfm" method="post" onsubmit="if
    (_CF_checkmyfrm(this)) return check_pw(); else return false;">
    Password: <cfinput type="Text" name="PW1" message="Integers only..."
    validate="integer" required="No" value=""><br>
    Re-enter Password: <cfinput type="Text" name="PW2" message="Integers only..."
    validate="integer" required="No" value=""><br>
    <input type="Submit"><br>
    </cfform>

    </body>
    </html>

    eastinq Guest

  14. #14

    Default Re: CFFORM Validation trumping Custom Form Validation

    Okay, I tried your approach but am running into some problems. When I use your
    "onSubmit" in <CFFORM> it doesn't provide any client side validation, only
    server side and it displays two messages for the same field. Also, it does not
    execute the custom validation at all.

    I have verified that the custom validation works by using the following:

    <cfform action="test-act.cfm" method="post" name="cma" onSubmit = "return
    ValidateForm('cma')">

    But when I use this version it doesn't work and I get the results I listed
    above:

    <cfform action="test-act.cfm" method="post" name="cma" onsubmit="if
    (_CFcheckcma(this)) return ValidateForm('cma'); else return false;">

    Any ideas on how to fix this?

    I've listed the appropriate code below:



    <script language = "javascript">
    <!--
    function ValidateForm(cma) {

    if (!HeardAboutRequired(cma,'heard_about')) {
    alert("Please select a name from the How did you hear about us? drop-down
    list box.");
    return false;
    }

    }

    function HeardAboutRequired(cma,heard_about) {
    var itemSelected =
    eval("doent." + cma + "."
    + heard_about + ".selectedIndex");
    if (itemSelected == 0) {
    return false;
    } else {
    return true;
    }
    }
    //-->
    </script>

    <cfform action="test-act.cfm" method="post" name="cma" onsubmit="if
    (_CFcheckcma(this)) return ValidateForm('cma'); else return false;">

    <cfinput type="text" name="first_name" maxlength="25" size="25"
    class="textbox" required="yes" validate="noblanks"
    validateat="onsubmit,onserver" message="Please enter your first name.">

    <select name="heard_about" class="textbox">
    <option value=" " selected="selected">- Select -</option>
    <cfoutput query="SelectLeadSources">
    <option value="#name#">#name#</option>
    </cfoutput>
    </select>

    <input type="submit" value="Request Market ysis" class="button">

    </cfform

    drmaves Guest

  15. #15

    Default Re: CFFORM Validation trumping Custom Form Validation

    Take off the validateat="onsubmit,onserver". This is causing the server side validation.
    eastinq Guest

  16. #16

    Default Re: CFFORM Validation trumping Custom Form Validation

    Thanks for taking your time to help me with this, I really do appreaciate it.

    I took out the validateat="onsubmit,onserver", which did eliminate the server
    side validation; however, I am not getting any validation now, either custom or
    CF.


    drmaves Guest

  17. #17

    Default Re: CFFORM Validation trumping Custom Form Validation

    When your page loads in the browser, do a view source to see the HTML that CF
    generated. Do you see a bunch of JavaScript code? There should be a function
    called _CFcheckcma(this) for your form. You should also have these JS includes:

    <script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
    <script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>

    If not goto the CF Administrator and set it under Settings.


    eastinq Guest

  18. #18

    Default Re: CFFORM Validation trumping Custom Form Validation

    I found my error while I was waiting for your reply.

    I was using _CFcheckmyfrm(this) in my code instead of _CF_checkmyfrm(this).

    After making that correction I added validateat="onsubmit,onserver" back in
    and it worked fine.

    Again, thanks for taking time to help.



    drmaves Guest

Similar Threads

  1. CFFORM validation trumping Custom Validation
    By Beals in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: July 16th, 11:33 PM
  2. CFFORM Validation Bug
    By deane_barker in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 14th, 03:54 PM
  3. CFForm Validation
    By Jomo in forum Macromedia ColdFusion
    Replies: 1
    Last Post: March 9th, 12:53 PM
  4. only custom validation control does server side validation?
    By Colin Mackay in forum ASP.NET General
    Replies: 0
    Last Post: June 25th, 07:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •