|
Post by Jerry Muelver on Jun 30, 2008 2:03:39 GMT -5
I want to type something in the small textarea, click on "Save JS Value", and transfer the contents of the small HTML textarea to the large RB textarea. Is the "wait" killing the transfer? cls html "<textarea id='txx'></textarea>" print "" html "<a href=""#"" onclick=""document.getElementById('nodisplay').value = document.getElementByID('txx').value;"">Save JS Value</a>" print cssid #nodisplay,"{display:inherited;}" textarea #xyz, "" #xyz SetID("nodisplay") print "" link #abc, "Is it really saved?", [yup] wait
[yup] print string$=#xyz contents$() print "JS value = ";string$
|
|
|
Post by kokenge on Jun 30, 2008 7:18:44 GMT -5
Hmmm! Not sure why your code don't work. So no help there. However I have a similar routine that works. Maybe it will be of some help..
TITLEBAR "Move Over" html " <script type='text/javascript'> <!-- function ClickHandler ( ) { document.getElementById('b').value = document.getElementById('b').value + ' ' + document.getElementById('a').value; document.getElementById('a').value = ''; } //--></script> " html "<table><TR><TD>" textarea #a,"",10,4 #a setid("a") html "</td><td>" html "<input type='button' name='btn' id='btn' value='>' onclick='ClickHandler()'/>" html "</td><td>" textarea #b,"",20,8 #b setid("b") html "</td></tr></table>" end
HTH
|
|
|
Post by Jerry Muelver on Jun 30, 2008 7:37:17 GMT -5
Thanks! I'll play with that a bit. However, I really need for the transfer to go from an HTML textarea (created by a JavaScript routine) to an RB element or var, so I can use RB to load and save file contents to the HTML textarea. I'm hoping some kind of tweak in my posted code will do the trick. If not, I'll wind up with a glorious write-only, no-save, no-load WYSIWYG editor, which would seriously limit its acceptance in the computing world.
|
|
|
Post by carlgundel on Jun 30, 2008 10:32:23 GMT -5
Are you using Firefox? Do you know how to use FireBug? That might give you a clue.
-Carl
|
|
|
Post by Jerry Muelver on Jun 30, 2008 14:44:19 GMT -5
I'll get FireBug installed on my FireFox 3. I've got six heavy-duty books on JavaScript, so it's just a matter of absorbing relevant information. I have had WhizzyWig running on PHP and on Perl. RB is just a tad different from those. This thing will really be slick when it's cooking!
|
|
|
Post by Jerry Muelver on Jul 1, 2008 6:23:23 GMT -5
Firebug won't download through my 19.kbaud dialup. I'll try again later, with the firewall killed. So I'm still clueless. Why does html "<a href=""#"" onclick=""document.getElementById('nodisplay').value = document.getElementByID('txx').value;"">Save JS Value</a>"
not work?
|
|
|
Post by Jerry Muelver on Jul 1, 2008 6:30:28 GMT -5
Could be making progress, here.... Kokenge, this works (create textarea in HTML): TITLEBAR "Move Over" html " <script type='text/javascript'> <!-- function ClickHandler ( ) { document.getElementById('b').value = document.getElementById('b').value + ' ' + document.getElementById('a').value; document.getElementById('a').value = ''; } //--></script> " html "<table><TR><TD><textarea id='a'></textarea></td><td>" html "<input type='button' name='btn' id='btn' value='>' onclick='ClickHandler()'/>" html "</td><td>" textarea #b,"",20,8 #b setid("b") html "</td></tr></table>" end
So, maybe I need to fancy-up my handler a bit.
|
|
|
Post by Jerry Muelver on Jul 1, 2008 6:59:39 GMT -5
Closer: TITLEBAR "Move Over" html " <script type='text/javascript'> <!-- function ClickHandler ( ) { document.getElementById('b').value = document.getElementById('a').value; } //--></script> " html "<textarea id='a'></textarea><br> <input type='button' name='btn' id='btn' value='Xfer' onclick='ClickHandler()'/>" print textarea #b,"",20,3 #b setid("b") print link #xyz, "Show it", [showit] wait
[showit] string$ = #b contents$() print print string$
Type in top box, click "Xfer", and it goes. Add to top box, click "Xfer", and bottom box gets rewritten with new contents. Click "Show it", and contents of bottom box gets printed. However, top box gets cleared. Why? Also click "Show it" a second time, and program crashes. Need a loop?
|
|
|
Post by Jerry Muelver on Jul 1, 2008 8:16:56 GMT -5
Wrapping the textareas in a FORM element to keep the top box from clearing doesn't help. When you click a SUBMIT link to affect the textareas, you get kicked back into the RB login screen. Use BACK button to get back into the IDE.
Maybe, set form METHOD to GET, intercept the SUBMIT and parse the URLkey$?
|
|
|
Post by carlgundel on Jul 1, 2008 9:42:28 GMT -5
Run BASIC does not maintain the contents of widgets that it didn't create. It doesn't even know they are there.
Why not replace
html "<textarea id='a'></textarea>"
with
textarea #a,"",20,3 #a setid("a")
-Carl
|
|
|
Post by kokenge on Jul 1, 2008 11:34:13 GMT -5
Carl, I think Jerry's stuff should work as long as RB doesn't do anything with stuff it didn't create. I'm new to this, but I've done stuff with data not created by RB. Javascript knows ALL content, and I'm assuming he is trying to get the stuff outside RB into a RB textarea using JavaScript.
What do you think??
Dan
|
|
|
Post by carlgundel on Jul 1, 2008 14:27:31 GMT -5
Clicking on the link causes a round trip. Data goes into the server, and the page is recreated. When this happens the textarea won't have anything in it because RB doesn't know the textarea exists, and it won't stick anything into it.
-Carl
|
|
|
Post by kokenge on Jul 1, 2008 16:33:03 GMT -5
Like usual, I guess I'm missing something. Here is a test I did with 4 textareas. 2 RB areas and 2 outside RB. a - RB aa - Outside RB b - RB bb - Outside RB
Put something in a and aa, click [>] and it moves it to b and bb. And sends a message back to a and aa just to make sure I'm seeing it.
When you click the [show Me] link , it makes the round trip and shows you what is in b. I realize I cannot see bb in RB because he don't know about it. Noticed I commented those out in the [showMe] area.
TITLEBAR "Move Over" html " <script type='text/javascript'> <!-- function ClickHandler ( ) { document.getElementById('b').value = document.getElementById('b').value + 'a=' + document.getElementById('a').value + '|aa=' + document.getElementById('aa').value;
document.getElementById('bb').value = document.getElementById('bb').value + 'a=' + document.getElementById('a').value + '|aa=' + document.getElementById('aa').value;
document.getElementById('a').value = 'clear a'; document.getElementById('aa').value = 'clear aa'; } //--></script> " html "<table><TR><TD>RB area (a)<BR>" textarea #a,"",10,4 #a setid("a") html "</TD><TD>Outside RB area (aa)<BR>" html "<TEXTAREA id='aa' ROWS=4 COLS=10></TEXTAREA>" html "</td><td>" html "<input type='button' name='btn' id='btn' value='>' onclick='ClickHandler()'/>" html "</td><td>RB area (b)<BR>" textarea #b,"",20,8 #b setid("b") html "</td><td>" html "</TD><TD>Outside RB area (bb)<BR>" html "<TEXTAREA id='bb' ROWS=8 COLS=20></TEXTAREA>"
html "</td></tr></table>" link #shoMe,"Show Me",[shoMe] wait [shoMe] b$ = #b contents$() 'bb$ = #bb contents$() print print "RB box (b):";b$ 'print "Outside RB box (bb):";b$ wait end
|
|
|
Post by Jerry Muelver on Jul 1, 2008 20:19:28 GMT -5
That's interesting, and certainly explains what I've been seeing. I'll have to absorb this paradigm, and figure out an adaptation. I'm working on that line of thinking. However, John Gordon's WhizzyWyg JS script grabs the declared textarea by its ID and reconfigures it as a rich-text editing box. It'll simplify things for me if I can still retrieve the contents of the control as an RB widget, of course. Might not work, but I'll find out. I have to figure out how to deal with recreating the page and its contents after the "Save" loopback from the server, maybe just read the newly-saved file back in to repopulate the newly recreated rich-text box. Where there's a will, there's a way....
|
|
|
Post by Jerry Muelver on Jul 1, 2008 20:22:26 GMT -5
Like usual, I guess I'm missing something. Here is a test I did with 4 textareas. 2 RB areas and 2 outside RB. a - RB aa - Outside RB b - RB bb - Outside RB .... Thanks. I appreciate your "tests" and find them very helpful to work with and experiment. I think I'm getting a handle on this RB <-> JS transfer stuff now.
|
|