View Full Version : dynamic FORM fieldname validation!!

08-17-2011, 08: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 "" >
Elemnt 2,2 is not defined
Element 2,2 is defined asc: #FORM.StartDateName22#

Philip M
08-17-2011, 08: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 );

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)

08-17-2011, 09: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