formrow->name; ?>" id="formrow->name; ?>" method="formparams('formmethod'); ?>"formparams('uploads') == 'Yes'){ echo ' enctype="multipart/form-data"'; } ?> action="" formrow->attformtag; ?>>-->and replace it with this (it was removed only the parameter name)formrow->name; ?>" method="formparams('formmethod'); ?>"formparams('uploads') == 'Yes'){ echo ' enctype="multipart/form-data"'; } ?> action="" formrow->attformtag; ?>> about line 183change soabout line 185generateCFToken($MyForm->formrow->name); ?>" />change sogenerateCFToken($MyForm->formrow->name); ?>" />"> How to get the form validation W3C XHTML Strict - Forums

Forums

How to get the form validation W3C XHTML Strict

vales 18 Nov, 2009
To get the form validation of Chronoforms need to make some changes to the file

components / com_chronocontact / chronocontact.html.php

Here are the changes

line 157 after this line
$actionurl = $MyForm->getAction($MyForm->formrow->name);

insert this
$actionurl = ereg_replace('&','&',$actionurl);


comment the line 171
<!--<form name="<?php echo ($MyForm->formname) ? $MyForm->formname : "ChronoContact_".$MyForm->formrow->name; ?>" id="<?php echo "ChronoContact_".$MyForm->formrow->name; ?>" method="<?php echo $MyForm->formparams('formmethod'); ?>"<?php if($MyForm->formparams('uploads') == 'Yes'){ echo ' enctype="multipart/form-data"'; } ?> action="<?php echo $actionurl; ?>" <?php echo $MyForm->formrow->attformtag; ?>>-->

and replace it with this (it was removed only the parameter name)
<form  id="<?php echo "ChronoContact_".$MyForm->formrow->name; ?>" method="<?php echo $MyForm->formparams('formmethod'); ?>"<?php if($MyForm->formparams('uploads') == 'Yes'){ echo ' enctype="multipart/form-data"'; } ?> action="<?php echo $actionurl; ?>" <?php echo $MyForm->formrow->attformtag; ?>>     


about line 183
<?php echo JHTML::_( 'form.token' ); ?>

change so
<p><?php echo JHTML::_( 'form.token' ); ?></p>


about line 185
<input type="hidden" name="1cf1" value="<?php echo $MyForm->generateCFToken($MyForm->formrow->name); ?>" />

change so
<p><input type="hidden" name="1cf1" value="<?php echo $MyForm->generateCFToken($MyForm->formrow->name); ?>" /></p>
simonetta 29 Jan, 2010
please can help me?
i do this modification to the file , i realize the validation in this way but the modul dont' work
can help me? can i paste the file modified so you can see if i do some mistake?
GreyHead 29 Jan, 2010
Hi simonetta.

Sure, please just paste 150-190 to make it easier to see the lines you've changed.

Bob
simonetta 29 Jan, 2010
<?php
/*
/**
* CHRONOFORMS version 3.1
* Copyright (c) 2008 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* @license GNU/GPL
* See readme.html.
* Visit http://www.ChronoEngine.com for regular update and information.
**/

/* ensuring that this file is called up from another file */
defined('_JEXEC') or die('Restricted access');
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

class HTML_ChronoContact {
// Procedure for building the table
function showform( $row, $posted ) {
global $mainframe;
$database =& JFactory::getDBO();
$MyForm =& CFChronoForm::getInstance($row->name);
$CF_PATH = ($mainframe->isSite()) ? JURI::Base() : $mainframe->getSiteURL();
if((!empty($MyForm->formrow->name))&&($MyForm->formrow->published)){
?>
<?php if (($MyForm->formparams('LoadFiles') == 'Yes')||( trim($MyForm->formparams('validate')) == 'Yes')||($MyForm->formparams('captcha_dataload'))){ ?>
<?php JHTML::_('behavior.mootools'); ?>
<?php } ?>
<?php ob_start(); ?>

<?php if ($MyForm->formparams('LoadFiles') == 'Yes'){ ?>
<?php if((!trim($MyForm->formrow->theme))||(trim($MyForm->formrow->theme) == 'default')){ ?>
<!--[if gte IE 6]><link href="<?php echo $CF_PATH.'components/com_chronocontact/themes/default/css/'; ?>style1-ie6.css" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if gte IE 7]><link href="<?php echo $CF_PATH.'components/com_chronocontact/themes/default/css/'; ?>style1-ie7.css" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if !IE]> <--><link href="<?php echo $CF_PATH.'components/com_chronocontact/themes/default/css/'; ?>style1.css" rel="stylesheet" type="text/css" /><!--> <![endif]-->
<?php
}else{
$directory = JPATH_SITE.'/components/com_chronocontact/themes/'.trim($MyForm->formrow->theme).'/css/';
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ( $file != '.' && $file != '..')
$results[] = $file;
}
closedir($handler);
$counter = 0;
foreach($results as $result){
?>
<link href="<?php echo $CF_PATH.'components/com_chronocontact/themes/'.trim($MyForm->formrow->theme).'/css/'.$result; ?>" rel="stylesheet" type="text/css" />
<?php
//$counter++;
}
}
?>
<script type="text/javascript">
<?php
echo "var CF_LV_Type = '".$MyForm->formparams('validation_type', 'default')."';";
?>
</script>
<link rel="stylesheet" href="<?php echo $CF_PATH; ?>components/com_chronocontact/css/calendar2.css" type="text/css" />
<link href="<?php echo $CF_PATH.'components/com_chronocontact/css/'; ?>tooltip.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo $CF_PATH; ?>components/com_chronocontact/js/calendar2.js"></script>
<script src="<?php echo $CF_PATH.'components/com_chronocontact/js/'; ?>livevalidation_standalone.js" type="text/javascript"></script>
<link href="<?php echo $CF_PATH.'components/com_chronocontact/css/'; ?>consolidated_common.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $CF_PATH.'components/com_chronocontact/js/'; ?>customclasses.js" type="text/javascript"></script>
<?php
include(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'libraries'.DS.'includes'.DS.'JSvalidation.php');
?>
<?php } ?>
<?php
if (($MyForm->formparams('LoadFiles') == 'Yes')||(trim($MyForm->formparams('datefieldsnames', '')))){
?>
<?php
if($MyForm->formparams('LoadFiles') != 'Yes'){
?>
<link rel="stylesheet" href="<?php echo $CF_PATH; ?>components/com_chronocontact/css/calendar2.css" type="text/css" />
<script type="text/javascript" src="<?php echo $CF_PATH; ?>components/com_chronocontact/js/calendar2.js"></script>
<?php } ?>
<?php JHTML::_('behavior.mootools'); ?>
<script type="text/javascript">
window.addEvent('domready', function() {
<?php
//include_once(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'libraries'.DS.'includes'.DS.'JSCustomClasses.php');
$datefieldsnames = explode(",", $MyForm->formparams('datefieldsnames'));
if(count($datefieldsnames)){
foreach($datefieldsnames as $datefieldsname){
if(trim($datefieldsname)){
HTML_ChronoContact::initiateCalendar(trim($datefieldsname), $MyForm);
}
}
}
?>
});
</script>
<?php
}
?>
<style type="text/css">
span.cf_alert {
background:#FFD5D5 url(<?php echo $CF_PATH.'components/com_chronocontact/css/'; ?>images/alert.png) no-repeat scroll 10px 50%;
border:1px solid #FFACAD;
color:#CF3738;
display:block;
margin:15px 0pt;
padding:8px 10px 8px 36px;
}
</style>

<?php if((trim($MyForm->formparams('validate')) == 'Yes')&&($MyForm->formparams('LoadFiles') != 'Yes')){ ?>
<script type="text/javascript">
<?php
echo "var CF_LV_Type = '".$MyForm->formparams('validation_type', 'default')."';";
?>
</script>
<script src="<?php echo $CF_PATH.'components/com_chronocontact/js/'; ?>livevalidation_standalone.js" type="text/javascript"></script>
<link href="<?php echo $CF_PATH.'components/com_chronocontact/css/'; ?>consolidated_common.css" rel="stylesheet" type="text/css" />
<?php include(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'libraries'.DS.'includes'.DS.'JSvalidation.php'); ?>
<?php } ?>
<?php if( (trim($MyForm->formparams('validate')) == 'Yes')||($MyForm->formparams('LoadFiles') == 'Yes')){ ?>
<script src="<?php echo $CF_PATH.'components/com_chronocontact/js/'; ?>jsvalidation2.js" type="text/javascript"></script>
<?php
$jsformname = "ChronoContact_".$MyForm->formrow->name;
$valonBlur = $MyForm->formparams('validate_onlyOnBlur', 1) ? 1 : 0;
$valonSubmit = $MyForm->formparams('validate_onlyOnSubmit', '0') ? 1 : 0;
$valwait_time = $MyForm->formparams('validate_wait', 0);
echo "<script type='text/javascript'>
var fieldsarray = new Array();
var fieldsarray_count = 0;";
echo "window.addEvent('domready', function() {
elementExtend();";
echo 'setValidation("'.$jsformname.'", '.$valonBlur.', '.$valonSubmit.', '.$valwait_time.');';
echo "});";
echo "</script>";
?>
<?php include(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'libraries'.DS.'includes'.DS.'JSvalidation2.php'); ?>
<?php } ?>
<?php if(!empty($MyForm->formrow->scriptcode)){
echo "<script type='text/javascript'>\n";
echo "//<![CDATA[\n";
eval("?>".$MyForm->formrow->scriptcode);
echo "//]]>\n";
echo "</script>\n";
}
?>
<?php if(!empty($MyForm->formrow->stylecode)){ ?>
<style type="text/css">
<?php eval("?>".$MyForm->formrow->stylecode); ?>
</style>
<?php } ?>
<?php $header_code = ob_get_clean(); ?>
<?php

?>
<?php
    $actionurl = ereg_replace('&','&',$actionurl);
?>
<?php
$session =& JFactory::getSession();
?>
<?php if($MyForm->formerrors){ ?>
<span class="cf_alert"><?php echo '<ol>'.$MyForm->formerrors.'</ol>'; ?></span>
<?php } ?>
<?php
if (($posted)&&($MyForm->formparams('captcha_dataload'))){
include_once(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'libraries'.DS.'includes'.DS.'JSrepublish.php');
}
?>
<form id="<?php echo "ChronoContact_".$MyForm->formrow->name; ?>" method="<?php echo $MyForm->formparams('formmethod'); ?>"<?php if($MyForm->formparams('uploads') == 'Yes'){ echo ' enctype="multipart/form-data"'; } ?> action="<?php echo $actionurl; ?>" <?php echo $MyForm->formrow->attformtag; ?>>   

<?php
$imver = "";
if ( trim($MyForm->formparams('imagever')) == 'Yes' ) {
$imver = '<input name="chrono_verification" style="vertical-align:top;" type="text" id="chrono_verification" value="" />
  <img src="'.$CF_PATH
.'components/com_chronocontact/chrono_verification.php?imtype='.$MyForm->formparams('imtype').'" alt="" />';
}
$MyForm->formrow->html = str_replace('{imageverification}',$imver,$MyForm->formrow->html);
eval( "?>".$MyForm->formrow->html );
?>
<p><?php echo JHTML::_( 'form.token' ); ?></p>
<?php if($MyForm->formparams('enablecftoken', 1)){ ?>
<p><input type="hidden" name="1cf1" value="<?php echo $MyForm->generateCFToken($MyForm->formrow->name); ?>" /></p>
<?php } ?>
<?php if($MyForm->pagetype != 'chronocontact'){ ?>
<?php $session->set("cfreturnurl_".$MyForm->formrow->name, $MyForm->selfURL(), md5('chrono')); ?>
<?php } ?>
</form>

<?php eval(base64_decode('JGRvY3VtZW50ID0mIEpGYWN0b3J5OjpnZXREb2N1bWVudCgpOw0KJGRvY3VtZW50LT5hZGRDdXN0b21UYWcoJGhlYWRlcl9jb2RlKTsNCmVjaG8gJE15Rm9ybS0+YWRkaGFzaCgpOw==')); ?>

<?php
} else {
echo "There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management";
}
}
function selfURL() {
$uri =& JURI::getInstance();
$inbetween = '';
if($uri->getQuery())$inbetween = '?';
return $uri->current().$inbetween.$uri->getQuery();
}

function initiateCalendar($datefieldsname, $MyForm){
?>
myCal_<?php echo $datefieldsname; ?> = new Calendar({ <?php echo $datefieldsname; ?>: '<?php echo $MyForm->formparams('datefieldformat', 'd/m/Y'); ?>' }, { <?php echo $MyForm->formparams('datefieldextras', "classes: ['dashboard']"); ?> });
<?php
}


}
?>




thanks
simonetta 29 Jan, 2010
sorry but now appear as a blank page now

/components/com_chronocontact/chronocontact.html.php

this is the path right?
GreyHead 29 Jan, 2010
Hi simonetta,

As far as I can see that file is unchanged from the original .

Bob
sunrize 13 Apr, 2010
Hello!

I'm trying to validate my website, and got a few errors with the ChronoForms, and I've searched the forum for solutions, and I was wondering would the above apply on all or certian errors, if I change the file and replace them with the codes you mention will this solve my problem?

Here are the errors I got
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.abyarjo.com%2Fdesign%2Findex.php%3Foption%3Dcom_chronocontact%26chronoformname%3DWebDesignForm&charset=%28detect+automatically%29&doctype=Inline&ss=1&outline=1&group=1&user-agent=W3C_Validator%2F1.767

and here is the link of my online form http://www.abyarjo.com/design/index.php?option=com_chronocontact&chronoformname=WebDesignForm


Thank you for your help🙂
GreyHead 13 Apr, 2010
Hi sunrise,

There's a known problem with the & in the form submit url instead of &. Some of the other errors seem to follow from this so change it and then re-try the validation.

The line to change is mentioned here in the forums several times.

Bob
sunrize 13 Apr, 2010
Hi Bob,

Thank you the reply.

I've searched the form, and added the following

file - components / com_chronocontact / chronocontact.html.php

line 157 after this line

Code: Select all
$actionurl = $MyForm->getAction($MyForm->formrow->name);

insert this
Code: Select all
$actionurl = ereg_replace('&','&',$actionurl);

all the errors for the form were gone!


Thanks again Bob!
oleo80 17 Feb, 2012
Thanks to Bob I've found this topic and I'm trying to solve the problem of W3C validation.
My first stop is that I can't find the file
components / com_chronocontact / chronocontact.html.php

I'm using Chronoform 4.0 RC3.11 and I don't have the com_chronocontact direcotry. I've looked inside com_chronoforms / chronoforms.html.php but the file is different.

I'm quite disoriented!
Oleo.

EDIT: The solution above is for v.3. Now we have to find the solution also for v.4
GreyHead 17 Feb, 2012
Hi Oleo,

Sorry, I assumed that you were using CFv3 - I don't think we've had any other reports of this problem with CFv4 :-(

Bob
oleo80 17 Feb, 2012
That's not good...😟
A part from other reports, is it possible to ask developers where can we find the right place in the code in order to replace the ampersands?
oleo80 17 Feb, 2012
Yeah! Founded!
Take a look to line 76:
administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php


It's the right place where chronoforms write the "action" output.
$form_tag_array[] = 'action="'.$action_url.'"';


So we add 2 lines before:
$action_url = ereg_replace('&','&',$action_url);
$action_url = ereg_replace('&','&',$action_url);


Done.
GreyHead 18 Feb, 2012
Hi oleo,

Thanks for the fix. I've added this to the RC3.11 bug list and I've added a change to my Show HTML [GH] custom action. As ereg() is now deprecated I used this code
$action_url = str_replace('&', '&', $action_url);
$action_url = str_replace('&&', '&', $action_url);
$action_url = str_replace('&', '&', $action_url);

The second line handles the odd case where the first replacement leaves && in the URL.

Bob
oleo80 18 Feb, 2012
That's good!😀
vales 18 Feb, 2012
Also the tag name of form is not valid in XHTML Strict.

The tag is created at line 78 of
administrator\components\com_chronoforms\form_actions\show_html\cfaction_show_html.php

To validate the line should be commented

		//$form_tag_array[] = 'name="'.$form->html_form_name.'"';
GreyHead 18 Feb, 2012
Hi vales,

Does that break the form in any way? I know that some of Max's JavaScript uses the name tags - don't recall if that included the form name tag though.

Bob
vales 18 Feb, 2012
hi Bob,

I think that in javascript form elements should be called by id.

This is the problem with the w3c validation

Line 206, Column 264: there is no attribute "name"

…orm=provaemail&event=submit" name="provaemail" id="chronoform_provaemail" …

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

GreyHead 18 Feb, 2012
Hi vales,

I agree with you . . . but that wasn't really my question.

Bob
vales 18 Feb, 2012

Does that break the form in any way? ...



So far I have not encountered problems.

As soon as I will have news I will inform.
This topic is locked and no more replies can be posted.