Forum Discussion
Hi domladden,
As per my understanding following is my suggestion,
1. In a post page, add a custom component.
2. In customcomponet capture sumbmit(or Post) button action using jQuery
3. Stop Lithium post activity by returning false.
4. Read user entered subject and Body using jQuery,
5. Add your data which you want to add into the body.
6. Call Lithium post message API and pass subject and body.
7. Capture new message ID and URL return from post API and redirect user to the new message page.
Following is the code snippet:
$('.lia-button-Submit-action').bind('click', function(e) { $.ajax({ url : '/restapi/vc/boards/id/${coreNode.id}/messages/post', type : "POST", data: {"message.author":"login/${user.login}","message.subject":subject goes here,"message.body":new body goes here,"restapi.response_style":"view","xslt":"json.xsl"}, async : true, error : function(data){ }, success : function(data){ redirect to data.response.message.view_href; } return false; }
Hope this helps!
Regards,
Phani
Hi Phani, thanks for your reply and suggestion.
Correct me if I am wrong but is this is to bypass the traditional posting mechanism in order to insert something later?
I'm not sure that would be practical for our uses, would the ultimate front end set up be similar to what we currently have: http://i.imgur.com/lpIXxe5.png
Or would this be a different process?
Thanks,
Dom
- phani10 years agoAdvisor
Hi domladden,
Yes you are right, in my previous reply i have suggested to override traditional posting mechanism.
Other way is only override submit button action without overriding entire posting mechanism.
i.e.
$('.lia-button-Submit-action').bind('click', function(e) { /* Add content to existing body text box */ return true; }
Lithium will fetch the body from body editor to create post.
Hope this helps,
Phani
Related Content
- 4 years ago
- 10 years ago
- 8 years ago