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
Developer
gyubok
Posts: 518
Registered: ‎10-08-2009
My Device: Bold 9900
My Carrier: Telus

Get text from textarea in another page

Hi, web noobie here and I have a question that seem to have a simple answer but that I cannot figure out.

 

So I have index.htm and main.htm

 

In the main.htm, I have textarea and I want to get the text from that textarea to process it from index.htm. How can I do this?

Please use plain text.
Developer
biggerCC
Posts: 270
Registered: ‎12-13-2010
My Device: PlayBook 16GB, BB10 Dev Alpha
My Carrier: o2 (de)

Re: Get text from textarea in another page

Using different HTML pages is not recommended in apps at all...

Anyhow: how do you switch between these pages?

 

If you accomplish this via a regular link (<a>) it'll be a really dirty hack.

 

window.location.hash

could be your helper.

 

Let JavaScript rewrite that link from <a href="main.htm">test</a> to <a href="main.html#TextHere">test</a> where TextHere is the content of your TextArea.

 

In your main.html you can check for that hash for example with the following code:

  if(window.location.hash) {
      var hash = window.location.hash.substring(1);
      alert (hash);
  } else {
      // No hash found
  }

 

I can't guarantee that WebWorks fully supports window.location.hash, but this might be your only choice when using regular links...

- - -
My approved apps @ App World
Please use plain text.