Help - Search - Members - Calendar
Full Version: html for fields displayed on same page w/java?
HTMLHelp Forums > Programming > Server-side Scripting
non-profit
I am building a website for a user who wants to maintain it himself. He would only have to add/change/delete a short paragraph of code for every change that he wanted to make.

So I would like to build a form for him, editted by a script, that would then generate and display the code on the same webpage. So I need the ability to intersperse hard-coded values with the form fields and then display that.

I am such a JAVA novice blush.gif that I haven't a clue whether or not I can do this.

Help?
Brian Chandler
What do you mean by "JAVA"?

Of course it's possible to do "something like this", but your question is so vague and confused it can't be answered directly. Either try using a standard CMS (blog, whatever), or get someone to write a custom system, if that's necessary.
non-profit
I am not sure that I can be any more clear about "build a form for him, edited by a script, that would then generate and display the code on the same webpage."

But to expand on the JAVA: Is it possible to have a client-side JAVA script that--on the same HTML webpage--references the form fields outside of the form and have another client-side script that displays the form fields back to the same HTML webpage? Or do you think this would require a server-side script that would post to another webpage? I can't find an example of how to refer to form fields outside of the form.

I have not been on the help forums in several months. So I have just spent some time reading over quesions/replies in several forums. While a somewhat experieced XHTML and CSS coder, I am brand-new to JAVA and PHP. So maybe it is my sensitivity to my lack of expertise, but it appears to me that there is a noticable increase in replies that I would qualify as "testy."

Might I remind the vastly-experienced gurus that there is no such thing as a stupid question. "Vague and confused" might be better expressed as, "I don't understand your question."

Respectfully,
non-profit
non-profit
As my question is about JavaScript, not JAVA, should this post be in client-side scripting? If so, please move it.

Thanks.
Darin McGrew
QUOTE(non-profit @ Sep 18 2007, 03:48 PM) *
As my question is about JavaScript, not JAVA, should this post be in client-side scripting?
If you want the page on the server to be updated, then you'll need some sort of server-side program to update it.

Perhaps one of these CGI page-editing programs or these PHP page-editing programs will meet your needs.
Brian Chandler
QUOTE(non-profit @ Sep 19 2007, 07:48 AM) *

As my question is about JavaScript, not JAVA, should this post be in client-side scripting? If so, please move it.

Thanks.


I don't think the question is about Javascript; I think the question is about how to do something, which looks as though it requires a server-side script, and to which it looks as though Javascript is not the answer.

Someone else asked a very similar question, and found something from Darin's list called "...snippets..." (or similar). You might try looking at that.

The problem at the moment is that you are trying to guess what the words would be for what you want to do, without understanding what the words mean. So this stuff about having a "form edited by a [client-side?] script" really doesn't make any sense.

Christian J
QUOTE(non-profit @ Sep 18 2007, 05:25 AM) *

I am building a website for a user who wants to maintain it himself. He would only have to add/change/delete a short paragraph of code for every change that he wanted to make.

For a single plain text block you might put it in a text file: first the user edit it offline (with e.g. Notepad or some other text editor), next upload it to the server (either with e.g. Windows Explorer, which has simple FTP capabilities, or a dedicated FTP program), while finally the server includes it in the web pages with e.g. SSI or PHP. You should turn characters like &, < or > into entities, e.g. with http://www.php.net/manual/en/function.htmlspecialchars.php

If you'd rather let him make changes in an online form, this function might be useful: PHP http://www.php.net/manual/en/function.file-put-contents.php but then you also need a password protected form to make the changes in.

If there are several plain text blocks, or if they contain markup, some ready-made script like the ones Darin linked to should be simpler.



non-profit
QUOTE(Christian J @ Sep 19 2007, 02:33 AM) *

QUOTE(non-profit @ Sep 18 2007, 05:25 AM) *

I am building a website for a user who wants to maintain it himself. He would only have to add/change/delete a short paragraph of code for every change that he wanted to make.

For a single plain text block you might put it in a text file: first the user edit it offline (with e.g. Notepad or some other text editor), next upload it to the server (either with e.g. Windows Explorer, which has simple FTP capabilities, or a dedicated FTP program), while finally the server includes it in the web pages with e.g. SSI or PHP. You should turn characters like &, < or > into entities, e.g. with http://www.php.net/manual/en/function.htmlspecialchars.php

If you'd rather let him make changes in an online form, this function might be useful: PHP http://www.php.net/manual/en/function.file-put-contents.php but then you also need a password protected form to make the changes in.

If there are several plain text blocks, or if they contain markup, some ready-made script like the ones Darin linked to should be simpler.


I solved my problem..sorry that I could not make the question clearer. I wanted a form that could generate HTML code based on form entries, with the generated code appearing on the same page as the form. Then the user could copy the code into the appropriate .html web page himself. After many false starts, I wrote a script that used document.getElementById and innerHTML. My solution is at http://www.dayclockrepair.com/code.html and the script is at http://www.dayclockrepair.com/scripts/code-generation.js. biggrin.gif
Brian Chandler
If it works, that's fine. You should know some of the advantages of a server script, though. You can do things like checking that the image file is there, and finding its pixel size automatically.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.