Hi everybody,
I've form where i can insert dynamic fields with javascript. If i want validate this fields, can i use chronform actions or i must create javascript code ad hoc?
thanks!
I've form where i can insert dynamic fields with javascript. If i want validate this fields, can i use chronform actions or i must create javascript code ad hoc?
thanks!
Hi Lapo,
If you are inserting them with JavaScript then I think that you need to register the validations you need. If you are un-hiding them then you can set validations when they are built, but disable the inputs and then enable them when they are un-hidden.
Bob
If you are inserting them with JavaScript then I think that you need to register the validations you need. If you are un-hiding them then you can set validations when they are built, but disable the inputs and then enable them when they are un-hidden.
Bob
Thanks! The form gives you the ability to add various family members, so they are not hidden. I have to validate them with a script made by me?
by this script...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
(function(jQuery){
jQuerycountForms_pm = 1;
jQuery.fn.addForms_pm = function(){
jQuerycountForms_pm++;
var myform_pm = "<fieldset><legend>......</legend><ul class='clearfix'>"+
" <li class='ccms_form_element cfdiv_text' id='name_o_gestore_container_div'><label>name</label>"+
" <input type='text' name='name_"+jQuerycountForms_pm+"'></li>"+
" <li class='ccms_form_element cfdiv_text' id='surname_o_gestore_container_div'><label>surname</label>"+
" <input type='text' name='surname_"+jQuerycountForms_pm+"'></li>"+
" </ul>"+
" <div class='box-btn_remove'><input type='button' id='remove_pm' value='remove fields' class='btn_remove' /></div>"+
"</fieldset>";
myform_pm = jQuery(myform_pm);
jQuery("#remove_pm", jQuery(myform_pm)).click(function(){
jQuery(this).parent().parent().remove();
});
jQuery(this).append(myform_pm);
document.getElementById("count_field").value = jQuerycountForms_pm;
};
})(jQuery);
jQuery(function(){
jQuery("#add_pm").bind("click", function(){
jQuery("#container").addForms_pm();
});
});
</script>
</head>
<body>
<div id="container" class="ccms_form_element cfdiv_submit">
<fieldset>
<legend>...</legend>
<ul>
<li class="ccms_form_element cfdiv_text" id="nome_o_gestore_container_div">
<label>name</label>
<input maxlength="150" title="" label_over="0" hide_label="0" type="text" value="" name="name_1" />
<div class="clear"></div>
<div id="error-message-name"></div>
</li>
<li class="ccms_form_element cfdiv_text list30" id="descrizione_intermediario_o_gestore_container_div">
<label>surname</label>
<input maxlength="150" title="" label_over="0" hide_label="0" type="text" value="" name="surname_1" />
<div class="clear"></div>
<div id="error-message-surname"></div>
</li>
</ul>
</fieldset>
</div>
<div class="ccms_form_element cfdiv_submit" id="add_altri_opratori_container_div">
<input type="hidden" name="count_field" id="count_field" value="1" />
<input type="button" id="add_pm" value="add fields" />
<div class="clear"></div>
<div id="error-message-add_altri_opratori"></div>
</div>
</body>
</html>
This topic is locked and no more replies can be posted.