• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Show/hide Group

Status
Not open for further replies.

Incremental

Member
Hi,
I know that there are many posts about the subject, and some informations in the Wiki, but I need some explanations on the new templates.
I just would like to have a simple AJAX Form used by Admin to reply to a Contact Form
This Admin Form has 2 Groups (Contact, Reply) and should behave like this :
  • by default only the Contact Group is showed (user contact information) WITH a 'Reply' toggle button.
  • clicking on the 'Reply' toggle button should make appear/dissapear the 2nd Group : Reply which contain answer fields and a button to send answer email
Could you put me on the way for that ?
Thanks by advance.
 
Sounds simple !
1) could you explain code in
http://fabrikar.com/forums/index.php?wiki/accordion-form-groups/
which should do the job ? and tell me why it's not working ?

2) I finally added 2 JS events on my Element button 'Fill Reply fields'
  • onload hide is working
  • onclick : I get a problem !
    if I use a predefined action show, it's working also, but one shot (normal)
    but what about toggle ??? I only see 'slide toggle' which doesn't work.
  • With Firebug, I see also the following error :
    TypeError: btn is undefined data[btn.name] = btn.value;
    when clicking on the button.
    AND I get a never ending 'Loading' spinner.
I would only have this button to show/hide Reply Group, but it looks like if it is submitting something...

3) Don't know if the toggle should be programmed in JS, but I also tried to use raw JS
Code:
document.id('group6').show();
or
document.id('group6').hide();
without success. What could be wrong with this syntax ?

PS : you can see it clicking on both EDIT and 'R?pondre JS' buttons
 
1 - I'm presuming you are refering to this page: index.php/fabrik/reply ? The code listed in the wik might well simply be for fabrik 3.0 - in any case its not what you need for this situation. That code toggles groups based on clicking on the group legend, not appropriate if you want to show / hide a group from a button click.

2 - Ahhh cough cough - looks like the button click event will also attempt to submit the form. I've fixed that in this commit: https://github.com/Fabrik/fabrik/commit/622a7d1d0842cd2471a5559f8718b26f66bc7d03

3 - doesn't look to be anything wrong with that js - the problem is probably the same issue as #2.
 
Thanks Rob,
but what about the missing Toggle Event in the Javascript plugin ?
It's exactly what I need and don't know how to do it !
 
not quiet sure what you meant there? There's the built in "slide toggle" fx which should work, (I've just fixed a small ish bug where it wasn't working if multiple fx's were applied to the same group)
To get it to work you basically set the condition options to always return true, as the toggle has to happen regardless of the element's value.
 
Sorry Rob,
it wasn't obvious that slide in/out/toggle was the same to hide/show
In fact, hide/show are working,
but slides and especially toggle don't do anything.
What could be wrong ?
Capture.PNG
 
you've got two conflicting effects on the same group? Not at all sure what you want to do there, but I would remove the "hide group reply" one and just use the toggle one.
 
Rob,
I unpublished the on load JS plugin and set the other one to "Slide toggle", but nothing happens.
(the onLoad hide was working)

I just want to load the form with Reply group hidden and if I click on the button Reply toggle appear On & Off of Reply group.
 
What Rob meant by "conflicting effects" is that you need to use the same effect to show / hide. So if you slide a group to hide it, you have to slide it to show it. If you use a simple hide, use a simple show.

Anyway, looking at this now. And it looks like there may be an issue with FX, as the hide/show on change test in my FX test form has quit working.

-- hugh
 
OK, that was a different issue ... ignore that one ...

The problem seems to be that you can't mix a slide in/out with a slide toggle. Not a Fabrik thing, seems to be a Mootools FX.Slide thing.

I'm still looking, to see if there's some way of getting this to work. But it looks like with Moo's FX, you can either hide/show specifically, or you can toggle, but you can't do both.

-- hugh
 
Cheesegrits,
I discovered that (from the frontend) :
  • in admin part : menu Fabrik / List Contacts / click on Edit
    the "Show reply Fields" button has no effects
  • in public form "Nous Contacter" the "Show reply Fields" button (who should be not visible according to my ACL) is perfectly working on the Reply group (who should be not visible according to my ACL)
Hope this could be a clue.
Thanks for help
 
Hugh - incremental asked me to look at this also, and I have just tweaked it. Button was not working because he was getting a JS error on a date element (from memory a get method wasn't working) - when I unpublished the date element, the JS started working.
 
Oops, Hugh just said that!!!

However, if you set the group display to "Yes, but hidden on load" you get a "display:none" on the group fieldset. Using a show JS action on this when you click the button doesn't work - because the fx for show reverses the effect of an fx hide and fx hide doesn't work the same way I guess. So you have to have an on-load event to hide the group so you can show it when the button is clicked. Pity.
 
Updated Github and disabled On Load event : Toggle is perfectly working.
I was confused by the On Load event, as I want to hide the Group when the Form is loaded.
  • It would be fine to change the label "Event" to "Element event"
  • Is it possible to add a Form load event ?
    or do you have a clue to implement it without a custom JS to put in components/com_fabrik/plugins/form/fabrikjs/scripts ?

PS : Wiki Javascript form plugin http://fabrikar.com/forums/index.php?wiki/javascript-form-plugin/
If you are using Fabrik 3.x onwards please see Fabrik 3 form javascript
Link is broken for Fabrik 3 particularities.
 
Thanks for the wiki !

If this can help others, the solution found by Sophist is :


  • On Load : When element "ReplyButton" is shown, slide toggle group "Reply"
  • On Click : When element "ReplyButton" is shown, slide toggle group "Reply"
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top