Skip Navigation

[Resolved] [cred_generic_field] setting values randomly (for "select" type)

This support ticket is created 6 years ago. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 14 replies, has 2 voices.

Last updated by Christian Cox 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#624615

I have this piece of code in an edit content form:

---------------------------
....
[cred_generic_field field='eliminacion' type='select' class='' urlparam='']
{
"required":1,
"validate_format":0,
"default":["0"],
"options":[
{"value":"0","label":"No deseo ni ocultar ni eliminar esta casa"},
{"value":"1","label":"Deseo ocultar esta casa"},
{"value":"2","label":"Deseo eliminar esta casa"}]
}
[/cred_generic_field]

[cred_show_group if="($(eliminacion) gt '0')" mode="fade-slide"]

Esta opción se aplicará a esta casa ("[wpv-post-title]")

[/cred_show_group]

[cred_show_group if="($(eliminacion) eq '0')" mode="fade-slide"]

<a href="hidden link" class="button" style="width:100%;text-align:center">Cancelar y volver a Mis Casas</a>

[/cred_show_group]

[cred_show_group if="($(eliminacion) eq '1')" mode="fade-slide"]

[cred_field field='form_submit' value='Confirmar Ocultar casa y volver a Mis Casas' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']

[/cred_show_group]

....
---------------------------

First time I display this edit content form it shows nothing - I would expect the message "Esta opción se aplicará a esta casa..." to be displayed (as 0 is the default option).

Strange enough if I navigate back and get into this page again the message "Esta opción se aplicará a esta casa..." is displayed correctly.

So this is working randomly, sometimes the messages are displayed correctly (based on the generic field "eliminacion") and sometimes nothing is displayed.

Can you please help me?

Thanks a lot in advance.

#624736

First time I display this edit content form it shows nothing - I would expect the message "Esta opción se aplicará a esta casa..." to be displayed (as 0 is the default option).
In the code you provided, that text should only be displayed if the generic field value is greater than 0:

[cred_show_group if="($(eliminacion) gt '0')" mode="fade-slide"]
  Esta opción se aplicará a esta casa ("[wpv-post-title]")
[/cred_show_group]

The default value is not greater than zero, it is equal to zero. So I would expect the link "Cancelar y volver a Mis Casas" to be displayed when the form loads the first time. If that is not happening, please provide a URL where I can see this on your site to check the markup. I will activate private reply fields here so you can share login credentials if necessary.

#624934

Okay please add the option "persist": 1, to the generic field contents:

[cred_generic_field field='eliminacion' type='select' class='' urlparam='']
{
"required":1,
"validate_format":0,
"persist":1,
"default":["0"],
"options":[
  {"value":"0","label":"No deseo ni ocultar ni eliminar esta casa"},
  {"value":"1","label":"Deseo ocultar esta casa"},
  {"value":"2","label":"Deseo eliminar esta casa"}]
}
[/cred_generic_field]
#624956

I've added the "persist" option and it's still not working.

i.e. it works randomly - please try several times and the problem will reproduce (no message).

BTW this "persist" option is not documented anywhere!?

I have the feeling that this is a BUG.

Let me know if you can reproduce the error.

Thanks..

PS: can u help me also with the other issue? (after we fix this one)

#625019

Sorry but I'm not able to reproduce the error. I'm using Chrome on a Mac, and I have opened an incognito browser so nothing is cached. You can see a screen recording here: hidden link

I tried many times using a combination of the back button, forward button, and mouse clicks. I could not reproduce the issue you mentioned. Am I missing a step somewhere? Is there a specific browser where I can see the problem better?

#625022

I'm using Firefox in a Linuxmint system.

Steps to reproduce:

1. Navigate to hidden link
2. Login with alvaroforo@gmail.com / 10721072
3. A house is shown. Click on "Eliminar Casa" --> sometimes I see the message and sometimes not.
4. If I see the message I go back and click again "Eliminar Casa" --> message is not shown.

Can you retry the above in Firefox?

Thanks and sorry for the hazard.

PS: and yes, I've cleared all cache (server side & Firefox).

#625042

Okay yes, I can recreate this in Firefox. Usually if I open a new private window, then log in, the first time I don't see any button at all. Even if I change the selected option, no buttons appear. When I return or reload the page, the button appears as expected and changing the select field toggles the CRED form groups as expected. So I did some tests and compared the HTML of the page on the first load vs. a reload, and I can see quite a few differences. Normally this indicates a caching plugin issue. Can you temporarily activate a default theme like Twenty Seventeen, deactivate all plugins except Types, Views, Layouts, and CRED, then test again? If the problem is still replicable consistently then I need to take a closer look. If the problem is not replicable, reactivate your theme and other plugins one by one until the conflict is revealed. My guess is that Jetpack or SG Optimizer is most likely involved.

Please let me know what you find out.

#625052

Hi Christian,

I also thought about a caching problem but I've retested this clearing ALL CACHES and still the issue.

But nevermind, I will proceed as per your instructions in my DEV environment and I will see if the problem persists without Jetpack & SG Optimizer. Will let you know.

Different story - what about the OTHER issue:

In an "Edit CRED Post Form" the bottom for submitting the form does NOT work. This is what I have in the form:

[cred_field field='form_submit' value='Guardar Modificaciones y volver a Mis Casas' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']

Whenever I click on that buttom it does nothing, previously it was working!

Steps to reproduce this other issue:

1. Navigate to hidden link
2. Login with:
Nombre de usuario (user name) = (same username as in private message)
Contraseña (password) = (same password as in private message)
3. A house is shown. Click on "Modificar esta casa". You will see details of the house which you can edit. Just click on the form submission bottom "GUARDAR MODIFICACIONES Y VOLVER A MIS CASAS" --> Nothing happens!! I would expect the changes to be saved and navigation goes back to the previous screen automatically.

Can you check this too?

Thanks!!

#625056

I also thought about a caching problem but I've retested this clearing ALL CACHES and still the issue.
Understood, but my point is that it's not just about generating new caches. There could be problems within the generated caches, and how the system utilizes those caches. I hope that makes sense. To rule out those problems it is best to disable caches completely and retest.

I'll check the submit button problem and update you shortly.

#625065

Okay I can replicate a similar issue with the Submit button on my local site. It seems to happen when a required image field is included in an Edit CRED form. The validation for the form seems to think the field is empty, and the browser tries to show an error. But the field itself is hidden, so no error is shown. I think this sounds like a bug, so I have escalated it to my 2nd tier support team for additional investigation. Stand by and I will update you when I have additional information to share about this. In the meantime, it appears that you must remove the required attribute from these custom image fields to submit the form.

#625084

Nice catch Christian , will test it 🙂

Thing is the submit form was working perfectly before the latest Toolset Type plugin update.

I'm going to replicate the issue in my DEV site and REVERT to the previous version of Toolset Type plugin.

Will let u know if this solves the issue - which, if it does, indicates a problem introduced in the latest version.

Will let u know tomorrow.

Thanks!

#625277

Hi Christian,

I did a test in my DEV site, this is the outcome:

Issue 1 (message not shown) --> I get the problem also in DEV, I need to investigate further and switch to the default theme and de-activate all other plugins (Jetpack and SG Optimizer), will let u know.

Issue 2 (submit button not working in Edit CRED form) --> I reverted "Toolset Types" plugin to v2.2.21 and it works perfectly. So the BUG was introduced in the latest version of this plugin (v2.2.22). I will revert to v2.2.21 in my production site. And will wait for the bugfix in the next version.

Does this make sense?

#625324

Yes that makes sense. Thanks for the update about the Types version, I'll pass it along to the team.

#625375

Hi again Christian,

For issue 1 (message not shown) I've found that if I de-activate the "Gravity Forms+Stripe" plugin the error is gone.

So ok, I will research further on this incompatibility.

Not sure if you report this kind of things (plugin compatibility issues) to your DEV team?

Anyway, pencils down, you can now close this thread 🙂

Thanks for your help.

Alvaro

#628836

Hi, an erratum has been published about this issue: https://toolset.com/errata/required-image-fields-cred-form-will-appear-not-set-re-upload-new-image/
You can find a patch file to use as a temporary solution.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.