Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 4
Registered: ‎01-23-2011
My Device: Curve 8330
My Carrier: Telus

HTML form get method

Hello,

 

I am having trouble with forms. I may be missing something simple and just need a second look but I cant figure it out for the life of me.

 

I am trying to create a form that passes GET variables to itself. When I try to retrieve the variables they do not exists. Also, in the Solution Explorer (Visual Studio 2008) it is not showing the proper page that should be displayed. ie, it is showing i am accessing "configure.html" and not "configure.html?getvar1=1234&getvar2=9876"

 

My code for the form is below and the code I use to retrieve the GET variables works when I link to the appropriate formatted urls. It seems to work on the 9800 Torch Simulator  6.0.0.227 but not 9550 Storm Simulator 5.0.0.469 or my real device. Is this related to v5?

 

 

<form method="get" action="local:///configure.html"><br />
   <input id="conf_auth" type="text" name="auth" value="Enter Auth" />Authorization Key<br />
   <input id="conf_user" type="text" name="user" value="Username" />Username<br />
   <input id="conf_pass" type="text" name="pass" value="Password" />Password<br />
   <input id="conf_server" type="text" name="server" value="Server IP" />Server Name<br />
   <input id="conf_newconf" type="text" name="newconf" value="true" style="visibility:hidden;" /><br />
   <input type="submit" value="Submit Changes" />
</form>

 

Thanks for any help and guidance!

Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: HTML form get method

[ Edited ]

1. First, better if you show here about your method to retrieve the parameter values.

 

2. I've tested it yet, but on this time, you can try this optional codes:

<form method="get" >

or:

<form method="get" action="configure.html">

 

 


Highlighted
New Contributor
Posts: 4
Registered: ‎01-23-2011
My Device: Curve 8330
My Carrier: Telus

Re: HTML form get method

As I said my code works perfectly fine when I link to properly formatted URLS. But here goes anyways. 

 

 

document.$_GET = [];
var urlHalves = String(document.location).split('?');
if(urlHalves[1]){
   var urlVars = urlHalves[1].split('&');
   for(var i=0; i<=(urlVars.length); i++){
      if(urlVars[i]){
         var urlVarPair = urlVars[i].split('=');
         document.$_GET[urlVarPair[0]] = urlVarPair[1];
      }
   }
}

 

The problem is when I am clicking submit the variables are not being passed to the next page. I have written a "document.writeln(window.location)" on the page and it still shows that I am access local:///configure.html with no GET variables attached to the URL. I tried both of your suggestions with no success. It is so weird because as I said it works in the one simulator and in my browser is works fine as well.

 

New Contributor
Posts: 4
Registered: ‎01-23-2011
My Device: Curve 8330
My Carrier: Telus

Re: HTML form get method

I have also created a test page with the code below. No get variables are passed.

 

test.htm

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
	<head>
	    <meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" />
		<title>Untitled Page</title>

	</head>
	<body>
	<script type="text/javascript">
	    document.writeln(window.location);
	</script>
    <form action="test.htm" method="get">
        <input type="text" maxlength="20" name="test" value="test" />
        <input type="submit" value="submit" />
    </form>
	</body>
</html>

 

 

New Contributor
Posts: 4
Registered: ‎01-23-2011
My Device: Curve 8330
My Carrier: Telus

Re: HTML form get method

I could not find an answer to this so I simply created Javascript function to run an onclick function on the submit button.