18 Posts
ciabz
9 years ago
7
Topic

Hi there! Seblod is just awesome but I´m getting a hard time triyng to figure out what seems to be a simple task: use the Core42 field (name XX) to retrive a value and use this value on a conditional state. That´s what I´m trying:

- Core42 field: on PrepareStore field:

$user = JFactory::getUser();
$value = $user->id;

Storage: none

- On Site Form/Fields: Conditional States (5): and to some text field (name YY) configure:
States: is visible WHEN XX is equal (say) '15'

Well, the YY field keeps visible no matter who is the logged user. Any help will be very wellcome! Thanks!!

I´m using Joomla 3.3.6 and SEBLOD 3.4.2

Get a VIP membership
4229 Posts
Kadministrator
9 years ago
3
Level 1

Hi,

PrepareStore is happening before the storing of the value (after user clicks Save) so it is not the right event, you probably need prepareForm. BUT, there is much easier way to do this, jsut use normal text field and set its live value to User->id.

18 Posts
ciabz
9 years ago
2
Level 2

Hi Klas!! Thanks for the info! Just worked like a charm! To help the beginners:

To get the User->id and use the value on a conditional states, tha´s what I did:

1. Created a text field (say text_user_id), set the storage to none and put it on the hidden tab (just wanted it to perform on frontend form view construction).

2. On Live + Live Value (2): set live to User and configure>property>id

3. On Conditional States: define the use of the text_user_id to set the conditions over other fields.

Sometimes the easier way is the harder to figure out. Thank you Klas for the great support!!

18 Posts
ciabz
9 years ago
1
Level 3

Hi folks! Now I´m really confused.... I can retrieve the user->id only when creating the content (filling the form) BUT NOT when editing the content... What I need is to get the user id (or user groups) on live mode while creating AND editing content. Doing something wrong? Possibly a bug? Any clues? Thanks!!!

4229 Posts
Kadministrator
9 years ago
0
Level 4

Hi,

live values work either on edit or add, there is no difference between those two. But if field already has a value stored live value does not override it, what you could do is a workaround to have live value set on new field with storage set to none, then on the field that stores values use conditional is Filled by  and is Filled or is Changed as trigger (try which one works best)

4229 Posts
Kadministrator
9 years ago
2
Level 1

Sorry, I missed you already use conditionals, then probably your conditional is not good if it is not triggered on edit.

18 Posts
ciabz
9 years ago
1
Level 2

Hi Klas!! Thank you for your reply! The problem isn´t on conditionals, the point is that the field does not get the live value on edit mode. If you create a text field, set the storage to none, put it on the main tab, on On Live + Live Value (2), set live to User and configure>property>id it will show the correct user id of the logged user when creating the content (I mean, filling the form for the first time on frontend). However, the same field is empty on edit mode for the previously created content. And yes, it should show the user id on both modes (create and edit). Any clues? Thanks for the support!

154 Posts
WebOne
9 years ago
0
Level 3

Not an exact solution but you can retrieve the Article created by or even store the userid in a separate field when it is created, and retrieve it. You can check if an article has been created already by adding the Article ID to the list of fields and checking if it's empty or not.

Get a VIP membership