...

View Full Version : dynamic FORM fieldname validation!!



korssane
08-17-2011, 07:33 PM
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>

Philip M
08-17-2011, 07:50 PM
Thi appears to relate to Coldfusion, not Javascript.

Using Javascript you can check if a field exists:-



<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)

korssane
08-17-2011, 08:31 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum