/    Sign up×
Community /Pin to ProfileBookmark

write in textbox??

Hi all

I’ve got form and what I need is to write in textbox with data that I already have.

textbox is called “Sifra_smjestaja”
“firstname” is data that is needed to be writen in “Sifra_smjestaja”

Here is code

<!– Begin
firstname = unescape(params[“firstname”]);
document.write(” ” + firstname + “<br>”);
// End –>

to post a comment
JavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJan 06.2004 — Hi!

If you tell us, where "params" is coming from, maybe we can help...

Cheers - Pit
Copy linkTweet thisAlerts:
@fredmvJan 06.2004 — Maybe a variable passed through the query string? As [b]Pittimann[/b] already implied, it would be rather diffucult to help you out without seeing more code.
Copy linkTweet thisAlerts:
@ddragasauthorJan 06.2004 — Params are comming from the other page. "Mother page"

I have downloaded and used code from link [URL=http://javascript.internet.com/forms/passing-values.html]passing-values[/URL] .

I'm getting value that I need wrom "mother" page. Now problem is to put it on "child page" in form in certan textbox
Copy linkTweet thisAlerts:
@PittimannJan 06.2004 — Hi!

I already assumed that, fredmv, and it seems you're right, according to ddragas' last post!

Anyway, ddragas, can you post the code you already have??

Cheers - Pit
Copy linkTweet thisAlerts:
@ddragasauthorJan 06.2004 — Here is code


<!-- THREE STEPS TO INSTALL PASSING VALUES:

  • 1. Copy the form code into the first page with the form

  • 2. Paste the HEAD code into the second HTML page

  • 3. Add the final code into the BODY of your second page -->


  • <!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

    <BODY>

    <center>

    <form type=get action="passing-values-source.html">

    <table border=1>

    <tr>

    <td>First Name:</td>

    <td><input type=text name=firstname size=10></td>

    </tr>

    <tr>

    <td>Last Name:</td>

    <td><input type=text name=lastname size=10></td>

    </tr>

    <tr>

    <td>Age:</td>

    <td><input type=text name=age size=3></td>

    </tr>

    <tr>

    <td colspan=2><input type=submit value="Submit!">

    </td>

    </tr>

    </table>

    </form>

    </center>

    <!-- STEP TWO: Paste this code into the HEAD of your second document -->

    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">

    <!-- This script and many more are available free online at -->

    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin

    function getParams() {

    var idx = document.URL.indexOf('?');

    var params = new Array();

    if (idx != -1) {

    var pairs = document.URL.substring(idx+1, document.URL.length).split('&');

    for (var i=0; i<pairs.length; i++) {

    nameVal = pairs[i].split('=');

    params[nameVal[0]] = nameVal[1];

    }

    }

    return params;

    }

    params = getParams();

    // End -->

    </script>

    </HEAD>



    <!-- STEP THREE: Put this on the page that should read the values -->



    <BODY>



    <SCRIPT LANGUAGE="JavaScript">



    <!-- Begin

    firstname = unescape(params["firstname"]);

    lastname = unescape(params["lastname"]);

    age = unescape(params["age"]);



    document.write("firstname = " + firstname + "<br>");

    document.write("lastname = " + lastname + "<br>");

    document.write("age = " + age + "<br>");

    // End -->

    </script>



    <p><center>

    <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>

    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>

    </center><p>



    <!-- Script Size: 1.23 KB -->
    Copy linkTweet thisAlerts:
    @PittimannJan 06.2004 — Hi!

    Sorry - did'nt see the post with the link.

    Hoping, that you put the code properly into your page, you should use something like:

    firstname = unescape(params["firstname"]);

    document.forms[0].Sifra_smjestaja.value=firstname;

    This should work, if there is only one form on the page, or - if not, the form is the first one...

    Cheers - Pit
    Copy linkTweet thisAlerts:
    @ddragasauthorJan 06.2004 — Sory but it doesn't work. Here I'm sending you file. Please help me if you can

    [upl-file uuid=33b9f5c5-4a67-4b3d-b9a2-4b820f65287d size=9kB]new text document (4).txt[/upl-file]
    Copy linkTweet thisAlerts:
    @PittimannJan 06.2004 — Hi!

    I'm trying to give a careful statement: your code is a bit messed up - script tags all over the place (inside forms, tables, everywhere). For me , that's too chaotic for tonight.

    I'll have a look at your thread tomorrow morning - hopefully, someone else will help you in the meantime...

    Cheers - Pit
    Copy linkTweet thisAlerts:
    @ddragasauthorJan 06.2004 — Thnx Pittimann

    I really aprecheate your help.
    Copy linkTweet thisAlerts:
    @ddragasauthorJan 10.2004 — anybody

    PLEASE
    Copy linkTweet thisAlerts:
    @FangJan 10.2004 — line 125 document.form1.Sifra_smjestaja.value=firstname;

    You can not do this untill after the form(page) has loaded.

    Put it in an onload="document.form1.Sifra_smjestaja.value=firstname;"
    Copy linkTweet thisAlerts:
    @ddragasauthorJan 10.2004 — sorry but I'm complete begener.

    In what line sholuld I put

    onload="document.form1.Sifra_smjestaja.value=firstname;"

    Thank you for your help
    Copy linkTweet thisAlerts:
    @FangJan 10.2004 — This is easier for you: near line 118
    &lt;script language="JavaScript"&gt;
    &lt;!-- Begin
    firstname = unescape(params["firstname"]);
    document.write(' ' + firstname + '&lt;br&gt;&lt;input name="Sifra_smjestaja" type="text" id="Sifra_smjestaja" value="'+firstname+'"&gt;');
    // End --&gt;
    &lt;/script&gt;
    &lt;/font&gt;&lt;/strong&gt; &lt;/font&gt;&lt;/td&gt;
    ×

    Success!

    Help @ddragas spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.2,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,
    )...