10 years ago
12
Topic

Hi,

I would like to know if there is a way to have a "insert article" link that opens the article form in a pop up? i tryied no number modals plugin, but didnt work, any sugestions?

Thanks

Get a Book for SEBLOD
4229 Posts
Kadministrator
10 years ago
0
Level 1

You could add class cbpop to your link and add something like this to your template:

JCck::loadModalBox();
JFactory::getDocument()->addScriptDeclaration ( 
"jQuery(document).ready(function(){jQuery('a.cbpop').colorbox();});"
);

This would open link in colorbox popup

10 years ago
0
Level 1

Hi diogowernik,

Thank you Klas for your response.

I suggest for your case diogowernik to not add the javascript code above in your template. Why? You need to add a javascript file and add this file without hacking the template itself.

In order to add a custom javascript code, you can use a plugin "Code JS" included in the "Code Pack" in the SEBLOD market.

Regards,
Mehdi.

4229 Posts
Kadministrator
10 years ago
0
Level 1
JCck::loadModalBox(); 

needs to be run in php, so you will need to include it on one of the first three plugins from this pack, in code js plugin you would put only 

jQuery(document).ready(function(){jQuery('a.cbpop').colorbox();});
10 years ago
0
Level 1

Nice ;) I will try

10 years ago
0
Level 1

Hi diogowernick,

Please send us a response if our solution works. Like that we can change the status of this post as solved.

Regards,
Mehdi.

10 years ago
0
Level 1

Hi Mehdi,

Thanks for ask if worked, is because when i have to work with codes i get a little lost, so will take a little time to try... and understand how to use that codes with te plugin...

but is ok to mark as solved... later i say if i was able to do that :)

10 years ago
1
Level 1

Hi Again, could not make it work yet.

1) I created a JS field:

jQuery(document).ready(function(){jQuery('a.cbpop').colorbox();});

2) I created a free text field set to open a form to edit an article:

<p style="text-align: right;"><span></span> Edit</p>

3) I created a afterstore php field:

JCck::loadModalBox();

I think i am missing something... actually i think is about this php field!

Thanks

4229 Posts
Kadministrator
10 years ago
0
Level 2

Hi,

try moving php code to the beforerender plugin, afterStore is run after form is stored, so after you submit a form, I missed this detail.

Also you need to create link on your button (link it to the form) and add cbpop css class to it.

4229 Posts
Kadministrator
10 years ago
0
Level 1

Hi,

let me try to summarize what you need to do:

1. You need to add a link to the form on your button, you do that by clicking on button 2 on the right side. The select Form from the dropdown.

2. Click on small + next to the dropdown and enter cbpopup in the Class field

3. Add the following to the beforeRender code field:

JCck::loadModalBox();

4. Add the following to the javascript code field

jQuery(document).ready(function(){jQuery('a.cbpop').colorbox();});
10 years ago
0
Level 1

We are almost there :)

for the class instead of cbpopup i used cbpop ... 

So the popup is working, but it loads inside the pop up, the website page, logo, main menu, modules and form

i would like to load only the form... 

I think it is a configuration to do that! any tips?

Thanks

10 years ago
0
Level 1

Found it:

In + button, select Tmpl -> component

I think now is solved :)

215 Posts
iliil
8 years ago
0
Level 1

Hello, this is a great topic and fantastic feature.

My only problem is:

JCck::loadModalBox(); executed in beforeRender plugin adds the colorbox script to the html head in the first place ( before jquery), which couses JS error.

It works fine when JCck::loadModalBox();  executed in a custom content template, but without making it working in beforeRender plugin, there is no way to open modalbox in seblod generic template (seb_one).

Can you comment please?

Thanks

Get a VIP membership