Hi Syed,

Sorry, I didn't explain clearly enough where I see the problem.

I have a form for selecting and parameterising canned queries in header.tt which appears at the top of the martview page. When the user presses submit in my form, it goes to a new perl script I provide.

The perl script stores what the user has entered in the form (maybe into a session parameter), and converts the user input into a corresponding martview URL request.

The martview page is refreshed, filling in the appropriate filter and attribute selections - this works well. However, in refreshing the page, my form has also been refreshed, so the user selections in my form have been cleared. This is very user-unfriendly, the user may wish to see what has been entered in the form - which canned query and what parameters for that query, and maybe modify the parameters a bit and re-submit my form. My problem is how to find out what the user had entered in the form before the page was refreshed, since I don't have any server-side code in the martview page.

I hope I've made that clear - and maybe I've missed some obvious way to get the user entries back in the form?

Regards,
Roger.

Syed Haider wrote:
Hi Roger,

On Thu, 2008-02-21 at 23:33 +0000, Roger Hull wrote:
  
Hi Syed,

Thanks for your comments.

Well, just getting the xml of the biomart query is a possibility - it
might be possible to get back to what the user had selected/typed from
the xml. But really I want to store my own data which makes it easy to
reinitialise my form (in header.tt) to what the user had
selected/typed. (Also in some cases the same biomart query might have
arisen from more than one canned query.)

I guess AJAX is still an option for this job (with a simple perl
script to handle the request). Originally I thought of adding some
extra GET or POST parameters to the martview page to pass it this
information, but then I would need to be able to run a CGI script as
the page loads, which would involve hacking into your martview code.
As far as I can see you don't provide anywhere official for me to put
a CGI script which gets run when martview loads.

So I wondered if you have any other suggestions?
    

Looks to me the best option if you declare your own <form>...</form> and
have a PERL CGI script talking to it. would be easy to maintain and
eliminates the need to hack martview.

cheers
syed

  
If I write such a conversion function (xml -> URL parameters) I'll
certainly share it.

Regards,
Roger.

Syed Haider wrote: 
    
Hi Roger,

On Thu, 2008-02-21 at 17:36 +0000, Roger Hull wrote:
  
      
Hi,

I am in the process of adding some preformed queries to MartView. The
user will select from a list of queries, possibly enter some
parameters (depending upon the query), and I have code (either perl or
_javascript_) which will send the query to MartView using a Mart URL
Request. This works fine for my first test query. This is implemented
in _javascript_ added to header.tt and footer.tt.

My main problem is how best to find out using _javascript_ what query
was requested when I come back into the martview page (so I can
reselect the user's canned query and re-enter the parameters). Can you
suggest how I could do this, minimising the changes to the biomart
code as far as possible?

One idea I had is to handle the generation of the query URL from perl,
and store the canned query somewhere (in a session parameter maybe).
Then when I come back to the martview page, use an ajax request to
find out the details of the canned query.
    
        
by storing a 'canned query' in session param, what exactly do you intend
to store ? is it just like an XML query  which our XML button
generates ? then of course write a simple AJAX _javascript_ request and
ask from XML query. Currently, if you see the code behind OnClick() of
XML button, it asks for XML by setting the target to a new window, you
can call it exactly the same way and just avoid the target window bit.
AJAX code is already available in _javascript_ 'martview.js' which can be
reused. 


  
      
This seems rather complicated, but could all be done without changing
any biomart code, just adding _javascript_ to header.tt, and some extra
scripts on my server to handle the requests. But if you can suggest
something better (simpler :-) ) I would be grateful.

Also, do you have handy perl and/or _javascript_ functions to convert
between a query in xml format (for MartService) and URL format? It
would be convenient to store the canned queries as xml templates
(ready to fill in parameters), then convert the completed xml into a
URL query. I guess I can write such a function if necessary, but don't
want to re-invent the wheel.
    
        
I am afraid, we never felt a need to do this conversion, please feel
free to write such a conversion function. This may help other users in
the future.

good luck!

cheers
syed


  
      
Regards,

Roger


    
        
  
      

Reply via email to