Hi,
I’m building a widget that relies on the page being edited to establish the child pages available for selection within the widget (as a dropdown). It seems I can’t reliably use $_REQUEST[ ‘postId’ ] because that isn’t available when the widget data loads via ajax and the preview doesn’t work.
Someone raised a similar query (question 1) a little while back and I’m wondering if this is now available?
I was using autocomplete but it’s overkill in this instance. Similarly showing all pages presents the user with more options than they need. Another option is to use get_page_by_path but this isn’t ideal as the path might change in future and silently break the link.
Hope you can help.
Thanks
Just to add, the autocomplete field would be a more attractive option if it stored the chosen post ID in a hidden field and showed the post title to the user (in this instance I tend to make the title read only and provide a change link to clear this and the hidden field and reactivate the autocomplete UI).
I appreciate you may have your reasons for not doing it this way and that it is very much a feature request – I thought I’d seen one similar already (can’t find it just now), but if you’d like me to post it afresh please do let me know.
Hi,
Thanks for getting in touch. This isn’t currently possible, but I’ve submitted a change to allow for this in a future update.
Thank you for the feature request. I’ve logged it with the rest of the team.
Kind regards,
Alex
Hi Alex,
Just wanted to thank you for this. As it happens I ended up using the autocomplete control because of an extra use case I had not considered but hopefully this will still be a useful addition for the future.
Thanks
Hi, thanks for your reply and helpful feedback; great to hear you’re making progress. The pull request Alex linked to will be reviewed in the next few days (https://github.com/siteorigin/so-widgets-bundle/pull/2133).
Cheers
Andrew