I'm about to make a form that is going to be pretty long, so for this purpose I need the validation message to appear in the bottom of the form by the submit button. So I made a javascript that I tested first and works. Now the problem appears when I try it with chronoforms, nothing happens. I inserted the javascript in the javascript box without the open and close tags. I then tried in 'General' to input a 'Form tag attachment' as described in the FAQ to :
onsubmit=return Field()
And inserted:
var form = document.ChronoContact.energi;
at the top of the javascript.
But it didn't resolve the issue.
I made a simple form just for testing purposes:
The Javasript looks like this:
onsubmit=return Field()
And inserted:
var form = document.ChronoContact.energi;
at the top of the javascript.
But it didn't resolve the issue.
I made a simple form just for testing purposes:
<label>Name</label>
<input title="name" id="text_21" name="name" type="text" />
<input type="button" value="Submit" onclick="return Field()" />
<p>By pressing the button above, a function will be called. The function will give a required field message.</p>
<div id="results"></div>The Javasript looks like this:
var form = document.ChronoContact.energi;
var elem1 = document.getElementById('text_21');
function Field(){
val1 = elem1.value;
if(val1 == 0)
results.innerHTML=("Please enter your name");
}
Hi Marcielo,
Try ChronoContact_energi as the form id in your script (not ChronoContact.energi).
Bob
Try ChronoContact_energi as the form id in your script (not ChronoContact.energi).
Bob
Hi Bob
I tried your sugestion, but it didn't work 😟
The form can been seen here:
http://energi.bagge-web.dk/form.html
I tried your sugestion, but it didn't work 😟
The form can been seen here:
http://energi.bagge-web.dk/form.html
Hi Marcielo,
Please check in Firebug or some other JavaScript debugger.
I think that you have JQuery running in the template which will break the code anyhow; and if you run the form without the template you'll find that elem1 is not defined. I think that this is because the definition is beign called before the page is fully loaded. Use onLoad or domready to fix this.
Bob
Please check in Firebug or some other JavaScript debugger.
I think that you have JQuery running in the template which will break the code anyhow; and if you run the form without the template you'll find that elem1 is not defined. I think that this is because the definition is beign called before the page is fully loaded. Use onLoad or domready to fix this.
Bob
This topic is locked and no more replies can be posted.
