I build a site in EE, with a register form, using code from developers. The form should return error messages with AJAX.
I get it working when uploading the HTML and links to the Java script direct on line.
But it fails when using FW, with Crowbars and HTML mark-up. Comparing the two files in TextWrangler does not help me very much, they look -mostly- the same.
This is very odd.
I cannot show the live URL here, will PM anyone willing to help me out with this…
This is the basic form code from the developers:
<!doctype html>
<head>
<title>Simple Registration AJAX Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script type="text/javascript">
// prepare the form when the DOM is ready
$(document).ready(function() {
var options = {
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
// bind form using 'ajaxForm'
$('#register_member_form').ajaxForm(options);
});
// pre-submit callback
function showRequest(formData, jqForm, options) {
// anything you want to do before submit?
$('#output1').hide();
return true;
}
// post-submit callback - here is where we get the response from Simple Registration
function showResponse(responseText, statusText, xhr, $form) {
if(responseText.status == 'success')
{
$('#output1').html('<h2>'+responseText.heading+'</h2><p>'+responseText.content+'</p>');
$('#form-container').html('&nbps;'); // clear it.
}
else if(responseText.status == 'error')
{
$('#output1').html('<h2>'+responseText.heading+'</h2><p>'+responseText.content+'</p>');
}
$('#output1').show('slow');
}
</script>
</head>
<body>
<div id="output1">
</div>
<div id="form-container">
{exp:simple_registration:form ajax='y'}
E-mail: <input type="text" name="email"/>
<p>Password: <input type="password" name="password"/></p>
<p><input type="hidden" name="signup_key" value="aeb102f05245fd292c427ad80c4aaeec"/></p>
<p><input type="submit" value="Register account"/></p>
{/exp:simple_registration:form}
</div>
</body>
</html>
and this is what FW makes of it
<!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>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script type="text/javascript">
// prepare the form when the DOM is ready
$(document).ready(function() {
var options = {
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
// bind form using 'ajaxForm'
$('#register_member_form').ajaxForm(options);
});
// pre-submit callback
function showRequest(formData, jqForm, options) {
// anything you want to do before submit?
$('#output1').hide();
return true;
}
// post-submit callback - here is where we get the response from Simple Registration
function showResponse(responseText, statusText, xhr, $form) {
if(responseText.status == 'success')
{
$('#output1').html('<h2>'+responseText.heading+'</h2><p>'+responseText.content+'</p>');
$('#form-container').html('&nbps;'); // clear it.
}
else if(responseText.status == 'error')
{
$('#output1').html('<h2>'+responseText.heading+'</h2><p>'+responseText.content+'</p>');
}
$('#output1').show('slow');
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-Language" content="nl"/>
<title>test_register</title>
<meta name="viewport" content="width = 960, minimum-scale = 0.25, maximum-scale = 1.60"/>
<meta name="robots" content="NOINDEX, NOFOLLOW"/>
<link rel="stylesheet" type="text/css" href="http://www.mysite.com/edit/default_site/css/styles.css"/>
<style type="text/css">
<!--
body { font-family:Trebuchet MS,Arial,Helvetica,sans-serif; margin:0px; background-color:#fff; height:100% }
html { height:100% }
-->
</style>
</head>
<body>
<div id="PageDiv" style="position:relative; min-height:100%">
<div id="form" style="position:absolute; left:54px; top:26px; width:778px; z-index:1">
{exp:simple_registration:form ajax='y'}
E-mail: <input type="text" name="email"/>
<p>Password: <input type="password" name="password"/></p>
<p><input type="hidden" name="signup_key" value="aeb102f05245fd292c427ad80c4aaeec"/></p>
<p><input type="submit" value="Register account"/></p>
{/exp:simple_registration:form}
</div>
</div>
</body>
</html>
dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options