How can i get value of text area?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
i have two files

now code in index.php is below

    <script src="
    <link href=" " rel="styleshe
et" />
    <script type="text/javascript" src="code.js"></script>
    <style type="text/css">
        .CodeMirror {
        border: 1px solid #eee;
        height: auto;
    .CodeMirror-scroll {
        height: auto;
        overflow-y: hidden;
        overflow-x: auto;
    Integer : whole numbers e.g. -3, 0, 69. The maximum value of an integer
 is platform-dependent. On a 32 bit machine, its usually around 2 billion.  
64 bit machines usually have larger values. The constant PHP_INT_MAX is use
d to determine the maximum value.
    <pre class="codeguru">say 'hi';</pre>
    Let us now look at how PHP determines the data type depending on the at
tributes of the supplied data.
    <pre class="codeguru">say 'hello';</pre>
    Floating point numbers
    <pre class="codeguru">say 'you r amazing';</pre>
    Character strings
    <pre class="codeguru">say 'i am fine';</pre>
    <form class="hidden code-box" method="GET" name="sample">
    <div dir="ltr"><textarea class="php" name="codeguru"></textarea><
    <input type="submit" value="Run" onclick="execute();"/>
        <textarea id="print-result" disabled="true" cols="77"></texta

and code.js file contain code is given below

                var pre = this;
                var form = $('form[name=sample]').clone();
                var id = $(pre).attr('id');
                $(form).find('div textarea[name=code]').first().attr('id', i
            window.editors = [];
                window.editor = CodeMirror.fromTextArea(this,  
                    lineNumbers: true,
                    matchBrackets: true,
                    mode: "application/x-httpd-perl",
                    tabMode: "shift"
    function execute() {
                p5pkg.CORE.print = function(List__) {
                    var i;
                    for (i = 0; i < List__.length; i++) {
                      document.getElementById('print-result').value += p5str(List_
                    return true;
                p5pkg["main"]["v_^O"] = "browser";
                p5pkg["main"]["Hash_INC"]["Perlito5/"] = "Perlit
                p5pkg["main"]["Hash_INC"]["Perlito5/"] = "Perl
                var source = editor.getValue();
                var pos = 0;
                var ast;
                var match;
                document.getElementById('print-result').value = "";
                try {
                    var start = new Date().getTime();
                    var js_source = p5pkg["Perlito5"].compile_p5_to_js([s
                    var end = new Date().getTime();
                    var time = end - start;
                    // run
                    start = new Date().getTime();
                    end = new Date().getTime();
                    time = end - start;
                catch(err) {
                    //document.getElementById('log-result').value += "Err

everything is run fine in my code. in code.js pre tags are replaced by text
area and the code in textarea should be run because this project is of onli
ne perl editor. so now my problem is i have alert the value of text area by
 this code  

    var source = editor.getValue();

but that gives the blank pop up. so what i have to do for retrieve current  
value of textarea?

Re: How can i get value of text area?

On 7/9/2013 7:55 AM, wrote:
Quoted text here. Click to load it
<snip lots of unrelated code>
Quoted text here. Click to load it

And your PHP question is?

There is no PHP in what you posted - only HTML and javascript.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: How can i get value of text area?

Try posting at comp.lang.javascript

Re: How can i get value of text area?

On Tue, 09 Jul 2013 04:55:55 -0700, sanjayrathod273 wrote:

Quoted text here. Click to load it


Quoted text here. Click to load it

You need to perform the ritual on page 87 of "The Darkest Arts of  
Midnight - Pizza, Cola and ASM86 at 3AM"[1] using 2 goats, 5 chickens and  
a still shrink-wrapped copy of ms-dos 3.3, or alternatively 3.1415926 cc  
of cobra venom.

[1] If you're worthy of handling the sacred knowledge within the hallowed  
pages you already have a copy, which is why I don't need to tell anyone  
here where to obtain it.

Denis McMahon,

Re: How can i get value of text area? wrote:
Quoted text here. Click to load it

It is probably best to ask in a CodeMirror related support forum/newsgroup.

However, a hint from glancing over the lengthy code: you're assigning
new CodeMirror instances to window.editor in a loop, so window.editor
contains the last instance that was created.  You may consider
inspecting window.editors in the dev tools of your browser.[1]

And you may consider to get a real name, and to trim your code samples
to the required minimum to be able to reproduce the problem.[2]  And you
may consider avoiding global variables as far as possible.[3]

[1] <
[2] <
[3] <

Christoph M. Becker

Re: How can i get value of text area? wrote:

Quoted text here. Click to load it

No, you have copied them from < without telling us (or them).

You cannot simply copy the client-side code from a PHP-powered Web site  
(they are using WordPress, but the editor makes it clear already) and expect  
it to work the same at your box.  Also, you MUST NOT do that (except perhaps  
for non-public use; check your local Copyright laws – IANAL).

But any Web site that makes claims like

| PHP is a loosely typed language; it does not have explicit defined data
| types.
| PHP determines the data types by analyzing the attributes of data
| supplied.
| PHP implicitly supports the following data types […]

is not to be trusted anyway.

PHP is _not_ a “loosely typed” language (that term is “loosely *defined*”  
itself; avoid it).  It is a language with dynamic type-checking (at runtime,  
as opposed to static type-checking at compile-time).

That means it *has* “explicit defined data types”, but that symbols  
(variables, array member, classes, properties) do not have a type as in “is  
declared as” or “enforce” (at *compile time*), and that *values* have a type  
instead.  The type of the symbol is defined by the value it stores or refers  
to, at *runtime*.  In some cases, as with type hinting and setters/getters,  
more strict type-checking or implicit type conversion, can be enforced on  
function parameters and properties.  As such, PHP without type hinting can  
be called a “weakly typed” language according to Liskov and Zilles, and  
Jackson (referred in [1]).

Data types are supported in PHP *explicitly*.  Each PHP value has a type in  
the Zend2 PHP engine:

< etc.

So the gettype() function does _not_ “[analyze] the attributes of data  
supplied”, it just reads the “type” member of the zval and maps it to a  
human-readable string value.

As with other languages with dynamic type-checking (such as ECMAScript  
implementations like JavaScript, for a prominent example), implicit type  
*conversion* (in PHP also called “type juggling”) is performed with certain  

You are better off reading < , asking specific  
questions in this newsgroup, or taking a PHP class at than reading  
this tutorial.  And you will learn more about PHP by setting it up on your  
computer than by using a Web editor.

[1] <
When all you know is jQuery, every problem looks $(olvable).

Site Timeline