Forum Discussion
CarolineS This is not trivial, but your intuition was actually the right one! What you can do is to find the "spot" in the HTML markup of the original form where you want to inject the custom field with a Regular Expression, add the custom HTML markup (your custom field) to the match and replace the original match...
What you need to do first is to assign the original components markup to a variable, so we can "RegEx" it and then use ?replace("<your RegEx", "<Regex Match + new markup>", "rmis"), something like this:
<#-- create a variable that holds the original component's markup --> <#assing markup> <@delegate /> </#assign> <#-- figure out a "hook" for your RegEx and replace+inject custom field --> <#assign markup = markup?replace("<RegEx>", "<RegExMatch+CustomMarkup>", "rmis") /> <#-- and finally output what we just did --> ${markup}
you could probably also go the jQuery-route and inject the field client side, that might be easier than RegEx but might come with other issues (likely the user would see a field is "added" after page-load etc.). Would be interesting to see if both works though =).
untested exemplary code for the JavaScript/jQuery approach:
<@liaAddScript> ;(function($) { // define your custom field markup var $markup = $('<your custom field HTML>'); // inject the markup where you need it $markup.insertAfter('<selector where you want to inject the custom field after>'); })(LITHIUM.jQuery); </@liaAddScript>
hope it helps!
PS: if you really like to pay someone, Glowing Blue is available =)
Related Content
- 5 years ago
- 2 years ago