Forum Discussion

rizalvi's avatar
rizalvi
Mentor
12 years ago

How to set a default tag based on origin.

Let's say I have users coming from a non-community site. They click on a link and arrive on a new message page.

I can already set the subject through the url using "?message-subject=hello"

Is there a similar parameter for tags?

 

If not, any options open for me to use. 

 

Thanks.

2 Replies

  • AdamN's avatar
    AdamN
    Khoros Oracle
    12 years ago

    I don't believe there's a standard parameter for tags like there is for the subject, but you could potentially use your own parameter, read this parameter, and then update the tag field value using some JavaScript. It's not the most straight-forward approach, but it should be possible.

     

    As always, I'd suggest being careful about accepting user inputs via query string that are later rendered in the page. You'll want to be defensive about how you code this to avoid any code injection vulnerabilities.

     

    If you read the parameter using FreeMarker, there are some escaping and encoding builtins that should help:

    http://freemarker.org/docs/ref_builtins_string.html#ref_builtin_html

    http://freemarker.org/docs/ref_builtins_string.html#ref_builtin_js_string

     

    If you choose to do it entirely through JavaScript, there are similar methods available there as well.

  • rizalvi's avatar
    rizalvi
    Mentor
    12 years ago

    Thank you Oracle.

    Security isn't as much a concern since the orgin pages will come from our own intranet and reach a role restricted fourm.