Skip Navigation

[Resolved] cred_child_link_form attributes

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.

This topic contains 5 replies, has 2 voices.

Last updated by MattI4840 2 months, 3 weeks ago.

Assigned support staff: Minesh.

Author
Posts
#1675547

Tell us what you are trying to do?

I am using the 'cred_child_link_form' shortcode to link to a post form which is working without issue. However, I'd like to pass in an additional parameter to auto-populate one of the fields on the form. It appears from the documentation there is a way to add further attributes, but I'm unsure if this can be used to pass in parameters similar to the way the parent_id is passed in. Since there are no examples in the documentation of this shortcode with additional attributes, can you let me know if this is what that option is meant for, and if so a syntax example?

Is there any documentation that you are following?

https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/

Thanks!
Matt

#1675575

Just a quick update, I was able to get the output I was looking for by discarding the shortcode and manually forming the link and inserting field shortcodes per the below. This is more of a work around though, so I'd still like know if this can be done more easily with additional attributes in the cred_child_link_form shortcode.

<button><a href="<em><u>hidden link</u></em> item='@customer-discount.child']" target="_self">New Estimate</a></button>

Thanks,
Matt

#1676227

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As you may already have checked the shortcode: cred_child_link_form
=> https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_child_link_form

There is no attribute available to set the additional params that you can pass to URL. So, as far as I can see the workaround you use is the perfect solution in this case.

#1676759

Understood Minesh, I don't mean to be a bother, but could you kindly let me know what the attributes argument can be used for, the example says additional HTML attributes like onclick, but again there isn't any syntax example so I'm unsure how to implement it and now my curiosity is peaked.

Thanks,
Matt

#1677839

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Toolset Form's cred_child_link_form shortcode offers you the way you can set the attributes like class, target, style using GUI.

I checked the source code that generates the cred_child_link_form link and I found the following line:

	return "<a href='{$link}' " . implode( ' ', $_atts ) . ">" . cred_translate( 'Child Link Text', $text, 'CRED Shortcodes' ) . "</a>";

As you ca nsee the attributes are the addon attribes you can pass like onclick, rel etc..etc..

You can see the supported attributes for the anchor tags here:
=> hidden link

#1678033

My issue is resolved now. Thank you!