bbress custom fields, auto-populate topic content

I put this in “pimp your press”, but now I think it belongs in the troubleshooting forum. Not certain.

I have created custom fields for my bbpress topics, and I have learned how to auto-populate those fields when a user clicks a button. I have also learned how to auto-populate the Topic Title. I am using javascript to auto-populate the topic title. Here is how I assign the data:

$("input[name='bbp_topic_title']").val(data.title);

I am showing this as an example to show what I need. My question is; am I able to auto-populate the content of a new topic, much like I am doing with the title for a new topic?

To auto-populate the content of a new topic, I assume I need to have the correct term, which I think would be ‘bbp_topic_content’? So it would look like this?

I am thinking that I need some sort of “add_action” to get this accomplished? Do I need to create a new function? I’ve been looking in templates.php to try and get a hint to figure this out. Any help would be GREATLY appreciated. Thanks.

This is a rare event for me; I figured this out within 4 hours of posting it. I am including the solution in case someone else decides they want to do the same thing. I had the input name correct: bbp_topic_content. As I was guessing above, I merely had to create a new function. Below is the variable declaration in javascript, and the function that auto-populates the content field of a new topic:$("textarea[name='bbp_topic_content']").val(data.description);

No problem. I found out that I did not need to create that extra function after all. All I had to do was place ‘bbp_topic_content’ in the ajax function. Here is the javascript. I put more code below this.

Here’s how I did variable assignment in a different script, located within the loop where I am generating results. I did not include all the variable as this is long. Also, I am wondering if I could have done some type of auto-indexing instead of having to list each result. Luckily there are only 10, otherwise this would have been crazy.

@robin-w, here is my code for the custom fields. You will see where arguments and names match the variables being passed from javascript. This code was placed in a separate file as an additional plugin: