www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  WebPublisher PRO    Report Drop Down Choices in WPPRO
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
We are revisiting how we display some of our content in WebPubPro, and will be using v10, I noticed some discussion regarding being able to offer display options to web users (drop down box), without the default of showing all possible web forms being used (i,e. controlling on a report by report basis which (multiple) web forms will be available.

Does anyone know if this can be done? How would those parameters be passed?
 
Posts: 26 | Location: London, Ontario | Registered: Mon July 21 2003Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
If you construct the dropdown yourself, instead of telling Webpublisher to create one, you will gain the advantage you're looking for.

Use the following javascript which will fire on the select element's onchange event:

 
/*
Used in webforms to select other forms from a dropdown.
Option values contain actual form names, so option text is flexible.
*/
function dbtw_form_change_onvalue(select_object, action, params)
   {
   	//alert("enter");
   var new_form = escape( select_object.options[select_object.selectedIndex].value );
   var i = new_form.indexOf( "+" );
   while ( i >= 0 )
   {
	   new_form = new_form.substring( 0, i ) +
	               "%2B" +
	               new_form.substring( i+1, new_form.length );
	   i = new_form.indexOf( "+" );
	}

   var form_key = "RF=";
   var n1 = params.indexOf( form_key );
   var n2 = n1 + form_key.length;
   var n3 = params.indexOf( "&", n2 );
   var n4 = params.length;
   var form_change_url = action + "?AC=CHANGE_REPORT" +
                           params.substring( 0, n2 ) +
                           new_form +
                           params.substring( n3, n4 );
	window.location.href = form_change_url;
   }


Construct your dropdown like so, paying close attention to the onchange attribute. This assumes you're using DB/Text Webpublisher in ISAPI mode. If using CS Webpublisher ISAPI, switch out '/dbtw-wpd/exec/dbtwpub.dll' with '/ics-wpd/exec/icswppro.dll'.

<select id="mySelect" onchange="dbtw_form_change_onvalue(this, '/dbtw-wpd/exec/dbtwpub.dll', dbtw_params);">
     <option value="myFormName">Sort by Title</option>
     <option value="myOtherForm">Sort by Author</option>
</select>


Peter Tyrrell, MLIS
Senior Consultant
Andornot Consulting Inc.
http://www.andornot.com/about/developerblog
 
Posts: 179 | Location: Vancouver, BC, Canada | Registered: Thu September 20 2001Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Thank you. I am testing this out at the moment and do not know if I have included the script in the correct place. I am calling the script from the report header in the web form (designed in DBTextWorks). I have included that webform on my web query screen, so the the reulting form has the drop down box on it, however the script does not seem to execute.

Is that where the script should be located?

Thanks

Liz
 
Posts: 26 | Location: London, Ontario | Registered: Mon July 21 2003Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
The script, that is the dbtw_form_change_onvalue method, should be somewhere above the the select dropdown in the page hierarchy. Generally the head section of the page is preferred.


Peter Tyrrell, MLIS
Senior Consultant
Andornot Consulting Inc.
http://www.andornot.com/about/developerblog
 
Posts: 179 | Location: Vancouver, BC, Canada | Registered: Thu September 20 2001Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  WebPublisher PRO    Report Drop Down Choices in WPPRO