CSS & Javascript won't display in forms

smileylolo 28 Jul, 2007
CSS & Javascript won't display in forms

Hi!

Great component idea :-) It's very useful... but I have a quick query:

Is there any reason why I can't get css (powered by javascript) to display in chrono forms? It works when I put the form inside a joomla content page... and I've tried putting the css as a separate file in the header, as well as within the main template_css.css file and I've put the javascript both in the head tag of the template as well as in the appropriate form location... but it won't display anywhere at all.

The purpose of the javascript I have is to replace all form elements with customised form elements to make it look pretty... (and there is a relevant css file).

Please help!

Thanks
GreyHead 28 Jul, 2007
Hi smileylolo,

ChronoForms makes no significant changes to your form code except that it adds the <form></form> tags and imageverification code.

The most common reason for validation JavaScript not to work is that ChronoForms changes the name of the form. I don't see why this would be true of css JavaScript unless it uses the form name as a selector.

You can see css working OK in one of the tutorial videos, so it is quite possible to use it.

Please post some of your code here so that we can have a look and see what's happening.

Bob
smileylolo 28 Jul, 2007
Wow.. thankyou for the very quick reply...
Yes, I was using the form name but now I'm unsure how to make appropriate changes...

My form declaration was:

<div id="container">
<form action="vars.php" method="post" class="niceform" target="_blank">
...
</form>
</div>


In my javascript I had:

function getElements() {
	var re = new RegExp('(^| )'+'niceform'+'( |$)');
...
}

that referred to the form name directly.

Now I'm unsure how to add in class and div tags around the form... I couldn't see any options in the component and adding the above form tags within the chrono form tags did not work... I guess html doesn't allow forms within forms...

Thankyou again for all your help.
GreyHead 28 Jul, 2007
Hi smileylolo,

No, forms in forms don't work! However you can add attributes to the ChronoForms form tag with the 'Form tag attachment' field (on the General tab). Try putting class="niceform" in there.

And if you want the form Action url to be vars.php you need to put that in the 'Submit URL' field on the Form URLs tab.

Then you'll need to delete the <forms> tags from your form html.

Try those changes and see if they do the trick.

Bob

PS ChronoForms doesn't directly support <div>s around the form code but there are some workarounds that can fix that if it's really needed.<br><br>Post edited by: GreyHead, at: 2007/07/28 19:52
smileylolo 28 Jul, 2007
thanks so much!
it's basically all fixed now... just a few minor css tweaks.
This topic is locked and no more replies can be posted.