Skip Navigation

[Resuelto] Show a Cred Form to user after enable checkbox

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
How can I show the content of a CRED Form conditionally to what is selected in a Checkbox?

Solution:
1. In your CRED form, you can insert a CRED Generic Field of type Checkbox.
Choose to "save the value to the Database" when you insert the Generic Field.

2. Then, highlight everything in your CRED Form Code (all Fields that you want to hide initially) and click on Generic Fields > Conditional Group

3. There choose your above created Generic Field as the Data Source (condition) and pass the value that has to be true, to show the fields

4. If now the User of your CRED Form clicks (checks) the checkbox Field on the Front End where you display that CRED Form, all editable Fields of the Form will fade in and he/she will be able to edit them

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/

This support ticket is created hace 6 años, 9 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 respuestas, has 2 mensajes.

Last updated by mirjanaM hace 6 años, 9 meses.

Assigned support staff: Beda.

Autor
Mensajes
#391685

Hi,

after a user submits an event, other user can Register for that event. When he/she registers the eventcreator has an Option to decline/ accept registration.
After he accept the registration only then the Cred Form apper.
How can i do that...?
Have tryed a lot of things but nothing.

Parent Posttype ----> In there the Register button
- Event (slug:event)

Child Posttype of Event ----> In there the Selectfield or Ckeckbox to accept/decline the registration.
- Register (slug:register)

Child Posttype of Event ----> POST CRED FORM ID:X Only visible if checkbox/Selectfield is on accept.
- Reviews (slug:reviews)

my last try was something like this....

[wpv-conditional if="(is_checkt_in('check-in') eq 1)"][cred_form form='89' form_name='Ad a Review'][/wpv-conditional]
function is_checkt_in($field1){
    $val1 = get_user_meta(get_current_user_id(), 'wpcf-' . $field1, false);
    $val2 = get_post_meta( $post_id, 'wpcf-check-in', true );
    $val2 = sanitize_title($val2);
    $res = 2;
    foreach($val1 as $val){
        $val = sanitize_title($val);
        if($val == $val2){
            $res = 1;
            break;
        }
    }
    return $res;
}

have from this post https://toolset.com/forums/topic/complex-conditionals/#post-369129 . But it also not worked.
Hope you can Help. Its the last big step i have on my list.

regards mira

#391765

If you need the User to check a certain Check Box somewhere and display things according to that box (checked or not) you need to:

1. Save the Checkbox somewhere
2. Evaluate it's content somewhere
3. Show things according it's saved value.

Since you need a User(owner of event) to accept another user's application (applicant), the Checkbox must be editable by the Owner of the Event.

I don't know what exactly the Owner will do when accepting the Application, but simplistically seen, I would let the Owner of the Event EIDT the applications to his event.

Then, in the CRED Form to edit that Application you put everything in a CRED Conditional that is based on your Checkboxes Fields' value.
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/

If the Owner checks "Accept", the rest of the Form will appear and he will be able to edit it.

If he checks "not accepted" the Form's content own appear.

Of course I will need to know much more on what must happen, what must be edited or created, and what must happen generally, when the Owner accepts an Applicants application to the event.

#391779

So much text an i dont understand nothing, what you will try me to say.

I have explained all in first post.

Yes of corse the owner of an event will be able to edit his event, else there where no sense.

-------
Child Posttype of Event ----> In there the Selectfield or Ckeckbox to accept/decline the registration.
- Register (slug:register)

Here are stored informations of user who registered like name, email and so on. Also here are the Button/Radio/Checkbox or what is better for....

Check-IN the User who registred for that event.

After that the event creator checkt-in the user who registred, the will be display the cred form.

Dont know anymore how to explain it any better.

#391782

You did not elaborate the Event Owner will edit the Application / Registration.
You just informed me, he/she will "Accept/Decline" it.

I don't understand your wish.

I apologize this - it is most certainly my unknowkledge of your desired workflow.

As I elaborated, to let the Owner of the Event either approve or not a Registration, and only did the Registration if he/ she approves it, you must store the value of that checkbox first.

As example, you can try this (as elaborated above):

1. In your registration EDIT form which the owner of your Event will either edit or not, you insert a CRED Generic Field of type Checkbox.
Choose to "save the value to the Database" when you insert the Generic Field.

2. Then, highlight everything in your CRED Form Code (I mean, all Fields that you want to hide initially) and click on Generic Fields > Conditional Group

3. There choose your above created Generic Field as the Data Source (condition) and pass the value that has to be true, to show the fields

4. If now the Editor (Owner of the event) clicks (checks) the checkbox Field, all editable Fields of the Application will fade in and he/she will be able to edit them

Although I do not understand how this will help the Owner of the event to "accept or decline" a Application, as he/she will simply and only be able to edit the application.

I think, you need a Different Field set up with Types, where you store "Accepted or Declined"

That Field is hidden to the Applicant (when they register) and is shown only to the Owner of the Event when they edit the Application.

When they edit the Application they will see that field and can set "Accepted" or "Declined"

Does that help?

This is the Documentation for CRED Conditionals:
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/

#391793

Have already done.

Thank you anyway.