Web Analytics Made Easy -
StatCounter dynamic FORM fieldname validation!! - CodingForum

Announcement

Collapse
No announcement yet.

dynamic FORM fieldname validation!!

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic FORM fieldname validation!!

    Hi Guys,

    is there a way to ask if the #FORM.fieldname# exist to proceed with the next one ?

    FYI : StartDateName22 is a dynamic generated textbox

    i am using the following code :

    <cfif not isDefined (#FORM.StartDateName22#) or #FORM.StartDateName22# or EQ "" >
    <cfoutput>
    Elemnt 2,2 is not defined
    </cfoutput>
    <cfelse>
    <cfoutput>
    Element 2,2 is defined asc: #FORM.StartDateName22#
    </cfoutput>
    </cfif>

  • #2
    Thi appears to relate to Coldfusion, not Javascript.

    Using Javascript you can check if a field exists:-


    Code:
    <input type="hidden" id = "test99" value="test99" >
    
    <script type = "text/javascript">
    function checkFieldExists() {
    var fld = document.getElementById("test99");
    if (fld == null)     {
    alert ("Field test99 does not exist");
    }
    else {
    alert ("Field test99 has the value " + fld.value );
    }
    }
    </script>

    The secret of success in life is honesty and fair dealing. If you can fake that, you've got it made. - Groucho Marx (1890 - 1977)

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

    Comment


    • #3
      Sorry ,

      i really appologies

      beacuse iam using CF with Javascript i am completely confused with the right forms ,,
      thanks , i will put it in the CF forums as i need specifically to use CF isDefined syntax

      thanks again

      Comment

      Working...
      X