10 years ago
8
Topic

hello to all,
I know the question is stupid but I have no experience with seblod.
How do I insert javascript code in a form?
Thank you.

Get a VIP membership
251 Posts
Viktor Iwan
10 years ago
0
Level 1

What are you trying to achive ?

85 Posts
Jpeg
10 years ago
0
Level 1

You have many possibilities :

- in field inself, "Stuff" tab and pasted your code

- in a custom template, call javascript with joomla fonctionnality to do easier. But I give you an advice, write your code in a file, and you $doc = JFactory::getDocument() $doc->addScript(file.js) like that your file was loading only one time.


Jpeg

10 years ago
5
Level 1

Many thanks for your prompt reply.

Victor, I would like to produce of form variables, style 

http://www.quirksmode.org/dom/usableforms.html

Jpeg, "- in field inself, "Stuff" tab and pasted your code" 

this is a plugin or something?
Can not find it.
 regards


85 Posts
Jpeg
10 years ago
4
Level 2

No it's in field configuration itself. (not for all plugin.)

When you create a field, on bottom right ou have a string call "Stuff" (orange) clic on, and it develop other option : CSS & JS

Jpeg

10 years ago
3
Level 3

Hi Jpeg,

I'm tring to use "Stuff" tab and to add a javascript code but it doesn't always works. I've 2 different cases:

1. I added a map (using jquery) in a Contact Form and I wrote my code in the Stuff tab. I used "Site Form" to visualize the Contact Form in my website. And it works! if I use F12 the code is there.

2. I'm tring to add a slide show in a Content Type and wrote my code in the Stuff tab. I use "Content" to visualize it in my website. But it DOESEN'T work! So if I use F12 there is no javascript code. I also try to add the same javascript code in the template index.php and it works, so there aren't errors in code.

If you have any ideas please help me!

Thanks in advance

abram


85 Posts
Jpeg
10 years ago
2
Level 4

Hi abram,

that I said, stuff just for the plugin not big script !

if you need to do slideshow, carousel, etc you need to create variation of position and include script in, or custom template.

Jpeg

10 years ago
1
Level 5

Hi Jpeg,

and thanks for your answer. In both cases I only used Stuff for short calls (3 or 4 lines of code) to jquery plugins. I think the difference is between "Site Form" and "Content", also cause I tried to put in Content, the plugin that works in Site Form (the 1. example) and it doesn't works anymore. After that I also tried other lines of code but with the same result. It seems that Content's Stuff javascript code doesn't appear in HTML.

I never used before "Positions Variation" and so I'm just google it, could you give me some useful links?

Thanks

abram

10 years ago
0
Level 6

Done! Thx!

I use the official Variation Tutorial and put javascript code in a my custum Position Variation, as you said, and now it works. Great!

I always think there is a problem in Stuff Tab, but now I've an alternative solution.

Thank you

abram


Get a VIP membership