Skip Navigation

[Resolved] Select Field not outputting proper value for array('raw'=>true)

This support ticket is created 6 years, 8 months 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 15 replies, has 2 voices.

Last updated by Christian Cox 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#905826
Screen Shot 2018-05-29 at 2.08.58 PM.png

Since the recent update (3.0) any select field is outputting the field name rather than the raw value. This worked up until the last release.

For example:

I have a select field with the Options set "Display text = Open" and "Custom Field Content = open"

When I try to output the value using "types_render_field("price",array('raw'=>true));" it spits out the Display text rather than the Custom Field Content as it did previously.

This has caused so many issues on my site.

#905828

This is actually happening on radio buttons, not select as I said in my ticket.

#905907

Hi, please try this syntax instead:

types_render_field("price", array('output'=>'raw'));

You can see the output attribute defined here:
https://toolset.com/documentation/customizing-sites-using-php/functions/#radio

#905917

Was this recently changed?

I have been using 'raw'=>true on all my websites for over a year and from what I remember this was the syntax provided by the documentation. I have fields breaking all over the place on 25 websites now as of the latest update.

#905919

Yes, looking back at previous documentation it at one time was - array('raw'=>true) - for all field types.

This has broken every site I host. Will there be a fix for this? If not there may be many other users with this issue that have not noticed yet.

#906184

Let me try to get some additional information about this API difference from my 2nd tier support team and I will update you as soon as I have something to share.

#908407

Has this been looked into at all?

After researching this issue for the past week I have come across some more specifics.

- It appears that using array('raw'=>true) is no longer supported but was previously the suggested method.
- Some field outputs (ie: types_render_field( "my-image" ) ) will now actually output the guid (wp_toolset_post_guid_id?) instead of the URL in the image it generates.

This causes issues if the guid happens to be different than the url after a domain change. Typically you are not recommended to update GUID's in the database.

These two things have caused a lot of work on our hosted websites this past week. I just want to confirm that these things are being looked into. If it is a one off problem where we are not using types correctly please let me know.

Thank you.

#908914

Hi, yes we are looking into the issue where the types_render_field function is not working like before. Regarding your issue with image GUIDs, please open a separate ticket so we can investigate that independently of this issue.

#909371

- It appears that using array('raw'=>true) is no longer supported but was previously the suggested method.
I can see some other tickets in the forum that use this syntax, but no documentation, so I'm having trouble getting the team to acknowledge this as a backwards compatibility issue we should fix. I would like to keep trying. Can you tell me which version of Types and WordPress you were using before the recent update? I was able to get this syntax to work in some very old versions of Types and WordPress, but if you were using a more recent version that might help me argue the point.

#909377

Hey Christian,

I keep all my site plugins up to the latest version. It definitely would have been the version immediately preceding the 3.0 release.

Also, I know you told me to create another ticket for my other issue of Types outputting GUID's instead of urls but I have done that and immediately I get the response of "it must be a plugin conflict, deactivate all plugins to test".

I have done that and these issues both came up in the 3.0 release I have created a blank test site with nothing else activated and continue to see the issues. Perhaps they are related somehow?

#909393

Here is a more detailed sampling of what is happening. I have tried all of these output methods on a completely different website:

1: <img src="<?php echo types_render_field('test',array('raw'=>true)); ?>">
2: <?php echo types_render_field('test',array('raw'=>true)); ?>
3: <?php echo types_render_field('test');?>
4: <?php echo types_render_field('test',array('output'=>'raw')); ?>

This is what is output:

1: <img src="<img src="hidden link" />">
2: <img src="hidden link" />
3: <img src="hidden link" />
4: hidden link

Notes:

1: ignores the raw=true syntax and outputs the whole image tag. URL is coming from GUID instead of URL
2: ignores the raw=true syntax and outputs the whole image tag. URL is coming from GUID instead of URL
3: Outputs img tags as it should except url comes from GUID
4: Works as expected

#909395

Update: Problem solved?
After completely uninstalling the plugin completely and re-installing it seems to have corrected all issues.

1: <img src="hidden link">
2: hidden link
3: <img alt="" src="hidden link" />
4: hidden link

All outputting as they should be.
I guess this is a solution for anyone having the same issues. I will try this on all our sites and see if it corrects it across the board.

Thanks for your help.

#911163

Hey Christian, I have to re-open this ticket. I thought re-installing Toolset Types fixed it, but it turns out the version that was installed from WordPress plugins was the previous (pre 3.0) version. The next day it prompted me to upgrade to 3.0 and all the same issues came back.

Let me know if I need to open a new ticket or if you are still receiving notifications for this. Thanks!

#911490

Okay I received your message and I will reopen the ticket. I'm creating two mockup sites to show the difference between versions 2.2.23 and 3.0, and hopefully this will be sufficient for the team. Stand by and I will update you as soon as I can.

#912404

Just an update to let you know this issue has been acknowledged by 2nd tier support and escalated to our developers for resolution. I'll keep you posted here.