I have comments system on my website and I would like to allow my users to quote other user comments.
To do that i would like to use BBCode so it would look like this:
[quote]User Comment[/qute]
User reply text.
For now i made it like this:
I set initial value of multiline input as [quote]MultilineInput CustomState[/quote]
Whenever User clicks button “reply” i change CustomState to current comment text value.
The problem is:
When user start typing something in multiline input and then click button “reply” nothing will happen because “Initial Value” is set up only once - on page load.
Can i somehow manipulate multiline input value (not initial value) with the usage of button?
Not sure if this is possible, but I have a plugin (free) named “Insert at caret position”. Try it and check if this work for your case.
I guess that the correct process in your case will be Trigger on Button click “Reply” with actions: Set focus on the multi input element and use Insert at caret position the content you want to add
hummmmm, now I understood. There is an easy way to achive this final result with some changes…
What you will need is basically a hidden multiline input (let’s name it “hidden_multiline”).
When you click a reply button you will store the text of the comment in a custom state named “comment_text”.
You will write your reply in a multiline called “reply”.
And when you submit your reply, what will be send is the value of your “hidden_multilne”, that sould be filled with something like this:
[BBcode]comment_tex’s value[/BBcode]
reply’s value
The downside of this method is that you will never see the comment you are replying in the same input you’re writing. But anyway, it is an easy way to achieve what you desire…
Thanks for your input but… The thing is i would like to let user see to what he is replying and being able to edit this quote (like on oldschool forums).
Link the “Initial Value” of your reply input with your custom state “comment_text”.
Put the multiline reply field inside a group. Let’s call it “Group reply”.
When you click the reply button you will need two actions in your workflow. FIRST, use the action to reset Group reply (this will reset your multiline to its original state) and SECOND use the action to store the comment’s value in yout custom state “comment_text”.