CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Passing parameters from a URL field w/o db

Print topic Send  topic

Author Message
Andrew B
Posted: 02/07/2002, 6:29 PM

I have run into another annoying problem... I would like to transfer variables from a URL field in a menu form. The problem is, i can not create my own transfer variables, I have to link them to a DB.

I need to do something like this

somepage?spid=32

where spid is a known constant, but page2 can show records for any spid.

Is there any way to do this w/o hard coding the link into the menu text?

This seems like another feature that would be extremely useful! It would be pretty simple, you keep the current transfer scheme, but us to assign a 'default' value when we do not specify a db. field. Right now you can not pass parameters from menu forms since they can't be hooked up to a db.

Let's hear it for a more flexible menu form!
Nicole
Posted: 02/08/2002, 3:12 AM

Andrew,
in this case you should create url links on Menu form manually (it is quite easy). Add Label type field without caption and here is sample code for BeforeShow event:
ASP
fldField1 = "<a href = ""Any_Page.asp?spid=32"">Click Here to Go to Any page</a>"

PHP
$fldField1 = "<a href = \"Any_Page.php?spid=32\">Click Here to Go to Any page</a>";

Pat Couch
Posted: 02/08/2002, 4:20 AM

Here is what I just did to accomplish this.

In the "Before Show" event for the menu do this to get the ListenerID (or spid in your case.

'-------------------------------------------------------------
'Get ListenerID Parameter
LID = GetParam("ListenerID")

'Perform string manipulation to get desired result
fldListenerInfo = fldListenerInfo+"?ListenerID="+LID
fldListenerDetails = fldListenerDetails+"?ListenerID="+LID
fldListenerHomeInfo = fldListenerHomeInfo+"?ListenerID="+LID
fldListenerBusinessInfo = fldListenerBusinessInfo+"?ListenerID="+LID

'--------------------------------------------------------------

Hope this helps, I know I was banging my head on the wall over this. Turned out to be fairly simple, but sometimes it is easy to overthink things.

PC
Andrew B
Posted: 02/08/2002, 4:45 PM

Thanks. I'll go ahead and do that.

I need to submit that to CC as a suggestion, but I havent' done it yet. My main complaint is that you can only transfer DB variables from a URL parameter (from CC's interface) and I think that should not be fixed. It makes menus pretty inflexible. I have a page that shows different 'categories', but only one at a time, and I need to link to that page directly for only a few of them (say, a link to the cat. on the front page). Since i have to take my url params from a DB, i can't do that easily w/o custom code. This is something that can be solved w/o having to do any custom code with just a little modification to CC.
fcy
Posted: 02/13/2002, 12:47 PM

What if I wanted the 32 to be a field variable...what would the asp look like?
Andrew B
Posted: 02/13/2002, 7:43 PM

Nicole :
Yes that would work, but why make it so hard?
Why not just put that code in the menu's caption itself? That works perfectly, and it is what I do now. I was trying to find a way to do this w/o custom code (though i didn't think it could be done). I don't like mucking up my menus with html code in the caption since it makes them harder to read. Putting the link in the code is worse (sorta). I can still put the legible version in the caption and reset it later, but that means I have to maintain it in two places.

Re : Field Variable
What do you mean? I don't understand what a 'field' variable is. Do you mean passed like a form parameter? If that is the case, there are ways to hack that, but they are quite unweildy when you only have 1 line (and a small one at that) to write them in. Pretty sure the below will work, not *totally* sure about the JS in the onclick, though. There are other more general ways to do this type of thing (like making 1 form, and calling a function to set the hidden value and then submit the from (called form the href)) Oooh! I got 2 levels of parens.

--- example ----
<form name="mlink1" action="somepage.asp">
<input type="hidden" name="spid" value="32">
</form>
<a href="#" onclick="javascript:document.mlink1.submit();">Link Name</a>
--- end ----




Nicole
Posted: 02/14/2002, 4:35 AM

Andrew,
I suppose couple of lines of custom code is not hard work. That's why I've proposed you to use BeforeShow event.
Of course you may put html code directly to field caption as you don't use variable values, but I don't like it because the caption field itself is too small to see the long strings.

About variable names: fldField1. "Field1" is the field name specified at field->properties->common tab in 'Variable Name' field. fld+field_name is the variable name where the field name is stored.
Fred Y
Posted: 02/15/2002, 8:25 AM

Hi Nicole....

I gues all I was looking for was using

fldField1 = "<a href = ""Any_Page.asp?spid=32"">Click Here to Go to Any page</a>"

in before show of a grid....nameing the last column field1/label/check html etc. I can call an external page and pass the parameter 32 just fine. What I would like to do is simple use another field from the grid resuslts as the value for 32. I know this is easy and even was in an old newsgroup posting...but being a real idiot at the moment I just can't seem to find my way.....can you help?

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.