IE Validation failed?

gg4j 19 Dec, 2008
Hi guys, I m getting crazy, even if not because of you😉
So I thought I was finishing the web site.

Here come an issue.
Validation in IE are no more working...
It looks like the JS is not loaded... mmm


In the bottom bar of IE there's the triangle of problems.. Details says:
Line: 175
Character: 5
Error: '0' is null or is not an known object
Code: 0
URL: http://. . .


NO error in FF or Chrome.
GreyHead 19 Dec, 2008
Hi gg4j,

Definitely a JavaScript problem - can you post a link to the page?

Bob
gg4j 20 Dec, 2008
Greyhead, I am not drunk not sick, but I swear yesterday there was a problem with IE.
I've just checked, and there s not anymore..
actually I just made a change in the validation code with your suggestions.. maybe was that..
or maybe chache problem?

Anyway, I will post you the link privately.
thanks!
braziboy 05 Feb, 2009
Hi,

I don't know you already solved the ie problem, but i have a simular one. Everyting works fine in FF3 en Opera but all versionof ie give he following error:

Line: 419
Character: 2
Error: 'option' is null or is not an known object
Code: 0
URL: http://gouwopsinjoor.be/joomla/index.php?option=com_chronocontact&chronoformname=Marcelleks

When I use the form offline (in a local html file and local js file) ie doesn't have the problem. So it has to do something with the validation or the chronoform code i guess.
GreyHead 05 Feb, 2009
Hi brazilboy,

There's something pretty weird happening with the scripts, each time I click 'Submit' in FireFox I get another set of select boxes.

This could be a script error, a validation error or a conflict between YooTools and something else. (No, it's not a YooTools problem as it still happens with the index2.php version of the page).

Please remove your form JavaScript and see if that removes the problem. If you it needs debugging. If not, we can look again.

Bob
braziboy 05 Feb, 2009
Hi,

You get everytime a new line when you click on "toevoegen", but that's normal. People can order shirts, but if they need more then one model you can order more by clicking on the button. The submit button is on the bottom of the page and it's called 'bestellen'. I know that the layout to add lines is not yet perfect in ff, but it is in ie. So that's an other issue but that's all about html.
When i fill out the form and submit ('bestellen') it passes and i activated debugging and get all ok's. So i still wonder what the problem may be.

Thanks for the fast reply

* Form passed first SPAM check OK
* Form passed the submissions limit (if enabled) OK
* Form passed the Image verification (if enabled) OK
* Form passed the server side validation (if enabled) OK
* Form passed the plugins step (if enabled) OK
* Emails data loaded OK
* Form passed all before email code evaluation OK
* An email has been SENT successfully from (Gouw Opsinjoor)marcellekes@gouwopsinjoor.be to [email]braziboy@test.com[/email]
* Debug End

_POST: Array ( [naam] => test [voornaam] => braziboy [email] => [email]braziboy@test.com[/email] [groepsnummer] => 123456 [model1] => Mannenmodel [maat1] => Medium [aantal1] => 2 [model2] => Vrouwenmodel [maat2] => 42 [aantal2] => 2 [model3] => [maat3] => [aantal3] => [model4] => [maat4] => [aantal4] => [model5] => [maat5] => [aantal5] => [totaal] => 20 [undefined] => Bestellen [13db018495905048d72800e535f415e1] => 1 )

Max_admin 05 Feb, 2009
hi,

I think adding the new fields may lead to some problems, are you sure you paid attention to this ?

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 06 Feb, 2009
Hi braziboy,

Sorry, misunderstood the buttons.

Line 419 seems to be at the end of this function in your JavaScript
function addOption(selectbox, value, text)
{
	var optn = document.createElement("option");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}
The JavaScript looks fine to me so maybe there is some subtle conflict :-(

Bob
braziboy 07 Feb, 2009
Hi,

Thanks for the reply that my javascript is not the problem. I'm new to javascript so i was not sure about the code. So i started trying other things to find out what the problem/conflict could be. I found that the form has a conflict with the javascripts mooValidation.js. I started searching in the javascript code, but I don't have enough knowlegde of it. What it did to find out where the problem could was starting to remove functions and see i still had the problem. I found out that if i remove one of the following parts of the code you see below, the form worked fine but offcourse the validation didn't work anymore.
By removing 'initialize', 'submit' or 'reset' part/function the form worked perfect (except from validation). It didn't matter which of the 3 parts i removed, if i removed one the form already worked fine. removing the validation part didn't solve the form problem.

The problem in ie is when i select an option from the first drop down box, the second one disappears. Normally depending on the input of the first drop down box the options in the second one change. If you want to see how it should work, open the page in ff or opera, there it all works fine.

So i hope i narrowed down the problem to a small part of code and that someone has time to find the conflict between my form and the validation by mootools.

Thanks
var Validation = new Class({
	initialize : function(form, options){
		this.options = Object.extend({
			onSubmit : true,
			stopOnFirst : false,
			immediate : false,
			focusOnError : true,
			useTitles : false,
			onFormValidate : function(result, form) {},
			onElementValidate : function(result, elm) {}
		}, options || {});
		this.form = $(form);
		//Garbage.collect(this.form)
		if(this.options.onSubmit) this.form.addEvent('submit',this.onSubmit.bind(this));
		if(this.options.immediate) {
			var useTitles = this.options.useTitles;
			var callback = this.options.onElementValidate;
			this.form.getElementsBySelector("input, select, textarea").each(function(input) {
				input.addEvent('blur', function(ev) { Validation.validate(new Event(ev).target,{useTitle : useTitles, onElementValidate : callback}); });
			});
		}
	},
	onSubmit :  function(ev){
		if(!this.validate()) new Event(ev).stop();
	},
	validate : function() {
		var result = false;
		var useTitles = this.options.useTitles;
		var callback = this.options.onElementValidate;
		if(this.options.stopOnFirst) {
			result = this.form.getElementsBySelector("input, select, textarea").all(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		} else {
			result = this.form.getElementsBySelector("input, select, textarea").every(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		}
		if(!result && this.options.focusOnError) {
			this.form.getElement('.validation-failed').focus()
		}
		this.options.onFormValidate(result, this.form);
		return result;
	},
	reset : function() {
		this.form.getElementsBySelector("input, select, textarea").each(Validation.reset);
	}
});
GreyHead 07 Feb, 2009
Hi braziboy,

Hmmm . . . there clearly *is* a problem with your JavaScript. Not that it isn't good JavaScript but that it conflicts with the validation code. I'm afraid that kind of problem is all too common. I'll take a look when I have some time but those things aren't easy to find.

Bob
braziboy 07 Feb, 2009
Because it would be to difficult for me to find the conflict i started searching for an other javascript to populate my drop down box. I found an other one and it works like it's supposed to be. So don't mind searching anymore for the conflict. Everything works fine but i would like to make a special email template that depends on how many different t-shirts the person ordered. In the form people can add lines to order different t-shirts and in the email i would like to include only the fields they filled in. I'm not sure i made myself clear so i'll give some more explanation. People can order up to 5 different models/sizes (five rows in the form). If the quantity of a line in the form is not empty, i would like to include the fields of that line in the email. For the first line there is no problem because there are sure gonna order 1 if they fill out the form. On each line I have the fields 'model', 'maat' (means size in dutch) and 'aantal' (means quantity in dutch). They have the name of the field with a number aftr it. So on the 3rd line i have the fields 'model3', 'maat3' and 'aantal3'. So i was wondering how i could include in my email template that if aantal3 is not empty i write a line 'you have ordered {aantal3} t-shirts, size {maat3}, model {model3}.' Also i'm searching a way to insert the cf_id field in the email as a reference to pay. Because when i write {cf_id} in my template, it doesn't get the value, it just returns teh text {cf_id} in the mail.

Thanks
GreyHead 08 Feb, 2009
Hi braziboy,

I think that you can add PHP in your template to check field values and take actions accordingly. I'm not sure if you can use the {field_name} notation in the PHP or not - but that's simple enough to test.

Bob
This topic is locked and no more replies can be posted.