Forums

Parse Error: Broken Form

stmoist 04 Jun, 2009
An update of the software may have broken this form, I'm not sure when it stopped working. I searched around Google and the forums here, found some similar things that gave me some ideas (like making sure the email results was turned on and working), but I couldn't find anything that helped. It did work at some point. Currently running 3.1RC2. Any help would be greatly appreciated! Website

Parse error: syntax error, unexpected $end in /home/ncsac4pd/public_html/components/com_chronocontact/chronocontact.html.php(351) : eval()'d code on line 150



Code in question, lines 140-194
<?php } ?>		
		<?php if (($posted)&&($paramsvalues->captcha_dataload)){ ?>			
			<script type="text/javascript">			
			Element.extend({
				getInputByName : function(nome) {
					el = this.getFormElements().filterByAttribute('name','=',nome)
					return (el)?(el.length == 1)?el[0]:el:false;
				},
				setValue: function(value,append){ 
					if(value) { 
						value = value.toString(); 
						value = value.replace(/%25/g,"%"); 
						value = value.replace(/%26/g,"&"); 
						value = value.replace(/%2b/g,"+"); 
					} 
					switch(this.getTag()){ 
						case 'select': case 'select-one': 
							//this.value = value; 
							if ($type(value.split(","))=='array') value.split(",").each(function(v,i){value.split(",")[i]=v.toString()});
							sel = function(option) {
								if (($type(value.split(","))=='array'&&value.split(",").contains(option.value))||(option.value==value))option.selected = true
								else option.selected = false;
							}
							$each(this.options,sel);
							break; 
						case 'hidden': case 'text': case 'textarea': case 'input': 
							if(['checkbox', 'radio'].test(this.type)) { 	 
								//alert(value.split(",").contains(this.value)); alert ($type(value.split(","))); alert(this.name);
								//if(['1', 'checked', 'on', 'true', 'yes'].test(value)) this.checked = true; else this.checked = false; 
								//this.checked=((this.value==value)||(this.value == ','+value+',')||(this.value == '['+value+',')||(this.value == ','+value+']')||(this.value == '['+value+']'));
								this.checked=(($type(value.split(","))=='array')?value.split(",").contains(this.value):(this.value==value));
							} else {
								if(append) this.value += value; else this.value = value; 
							} 
							break; 
						case 'img': 
							this.src = value; 
							break; 
						//default: 
							//value=value.replace(//gi,"“"); value=value.replace(//gi,"”"); 
							//if(append) {this.innerHTML += value;} else {this.innerHTML = value;} 
							//if(append && this.scrollHeight) this.scrollTop = this.scrollHeight; 
							//break; 
					} 
					return this; 
				}
			});
			window.addEvent('domready', function() {
				<?php $post = JRequest::get( 'post' , JREQUEST_ALLOWRAW ); ?>
				<?php foreach($post as $data => $value){ ?>
				<?php if(is_array($value)){$value = "".implode(",", $value).""; $data = $data."[]";} ?>
					$('<?php echo "ChronoContact_".$rows[0]->name; ?>').getInputByName('<?php echo $data; ?>').setValue(<?php echo preg_replace('/[\n\r]+/', '\n', "'".$value."'"); ?>, '');
				<?php } ?>			
			});
			</script>
GreyHead 05 Jun, 2009
Hi stmoist,

The problem is at line 150 of your Form HTML. Please can you take a look and see what is around that area.

Bob

PS ChronoForms RC5.1 is now released.
stmoist 05 Jun, 2009
Line 150 is the closing div tag for the last piece of the form, and it changes to line 148 when I deleted the empty line and the clear div. I've just gone through and compared the settings with another form, and I just can't see where they're different!

<div class="form_item">
  <div class="form_element cf_button">
    <input style="width: 175px;" value="Click to Leave Feedback!" type="submit" />
  </div>
  <div class="clear"> </div>
</div>


As always Bob, you're the man. I'll upgrade to the latest version over the weekend, unless you think it will help!

Thanks

Steve

P.S. I looked at your websites in your sig, turns out we're in the same line of business (second link in my sig)! I was just facilitating a communications course the other day and Mehrabian's findings are part of our program. Fascinating stuff!
GreyHead 05 Jun, 2009
Hi Steve,

If it's showing the error in the last line there's probably an unclosed <?php ?> tag or a missing ; somehwere earlier in the code. If you can't spot it send me over the form html or a backup file and I'll take a look.

Bob

PS Will check out your website later when I'm in non-techie mode!
stmoist 05 Jun, 2009
Nailed it. I added a bit of PHP code a while back when I was trying to get the form to automate some functions, totally forgot about it and couldn't find it right away.

Thanks a ton!
GreyHead 06 Jun, 2009
Hi Steve,

That would do it! Glad you've got it fixed.

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