Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Moving field text into existing file.html?

    I'm somewhat new to javascript but feel it could be picked up easily. The webpage template my site expects me to fill out is quite messy so I'm aiming to create a front-end for filling it in easier.

    I need to learn entering text into a text field, and then having the code place the strings from each field into their proper home within the template. Without going through another "Hello World!" tutorial, what would you suggest I read up on?

    - Mike

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,332
    Thanks
    11
    Thanked 587 Times in 568 Posts
    i think it will prove difficult to modify the html files itself. if you could dump your template changes into a plain text file like json, you could serve the template and apply the template on either the server or the client using javascript. finding locations in html files is tricky at best, and often inconsistant and unpredictable when unknown user content is inserted.

    a compromise would be to build templates, render them yourself in the browser, and save/serve the resulting html files.

    i have a post in the codebank, "post a javascript", called loading and saving files than will show you the most basic example of what you want to do. perhaps you could modify it to suit your needs.
    Last edited by rnd me; 08-04-2008 at 08:19 AM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #3
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm.. A little over my head but I checked the file out anyways. I don't understand what needs to be in 'newPage.htm' to recieve and print the new text.

    I recall I've seen a way to output temporarly to the window for copy-paste. If I could get it to simply display all the finished html, that would still be a big help.

    Thanks for your reply too .

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,332
    Thanks
    11
    Thanked 587 Times in 568 Posts
    Quote Originally Posted by Mikemc View Post
    Hmm.. A little over my head but I checked the file out anyways. I don't understand what needs to be in 'newPage.htm' to recieve and print the new text.

    I recall I've seen a way to output temporarly to the window for copy-paste. If I could get it to simply display all the finished html, that would still be a big help.

    Thanks for your reply too .
    nothing needs to be in the newpage file, it is written with the test in the text box. in hindsight it would be better to have named the example newpage.txt instead....

    im ot sure exactly what kind of setup you are using, and what you looking to do with javascript.

    in firefox you can highlight a selection and right-click "view selection source" to see the updated code. you can click on the page;s bacground first, and then press <CTRL>+<A> to select all, then repeat the right-click v.s.s. thing to get a view of the whole, current page.


    if you are looking to bypass the template maker and dump html files, you could grab a rendered page using the above method for ajaxified pages, of the save page as for regular pages, and save it as a text file.

    you would then edit the html and replace the template areas with identifiers. i like "**title**" style placeholders, but you can use anything.
    javascript could then read in the file and replace **title** with textbox1.value for instance. the result could be saved or displayed in a textbox to paste and save.


    if you could describe your situation/goals in a little more detail, i can likely be a lot more useful.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #5
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks loads for your assistance! I've asked in 3 forums and this one has already steered me in the right direction . The template is for a videogame music site. I am one of the people who creates a page that lists game information and each track name and length. However instead of a simple "Open in your favorite webpage editor", the manager has given me a huge walkthrough on where in the code I have to place everything.

    So what I would like to do is to use text fields to enter in the necessary information, and then simply press 'Submit' and have the code place it all into it's proper places.

    Currently I'm looking into having the webpage code printed in a new window and telling the user to copy-paste the whole thing into notepad and save it as an .htm file. I believe the 'document.game_title.value' thing will be part of it.

    And I have no idea what Ajax code is.

    - Mike


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •