AnsweredAssumed Answered

How to get result of a webscript back to the dashlet

Question asked by kay_be_ on Jan 18, 2012
I made a dashlet that contains a form asking for a filename. It will be processed by a js that will seach the file and get the details displayed in that dashlet. Problem is that I can't find a way back from the javascript that s processing the post request back in to my dashlet.

helloworld.get.html.ftl
<div class="dashlet">
   <div class="title">File details</div>
   
   <form name="inputform" action="${url.service}" method="post" enctype='multipart/form-data'>
      Filename: <input type="text" name="filename" id="filename" /><br />
      <input type="submit" name="submit" value="submit" />
      
   </form>
   <#if filename?exists>
   <p>Filename is ${filename}</p>
   </#if>
   <p>error:
      <#if error?exists>   
   ${error}</#if></p>
</div>
It is registered as a dashlet and the helloworld.get.desc.xml description is
<webscript>
  <shortname>get file name</shortname>
  <description>get file name</description>
  <url>/demo/helloworld</url>
  <family>user-dashlet</family>
</webscript>

After a submit it calls a webscript helloworld.post.js
var file="";

for each (field in formdata.fields)
{
  if (field.name == "filename")
  {
    var file = field.value;
  }

}
model.filename= file;

This JS is eventually going to get more file details and it will make this available in the model.
Now I want to return to the original dashlet using the filename in the model. I can go to helloworld.post.html.ftl with that data but it is not the dashlet but a white page where I can make a template for the model but it is not a dashlet. How can I let it return to the original dashlet?

If more code details are needed or the story is not clear I'll be glad to provide more details.
regards

Outcomes