• Form that creates a pre-made web page

    Home » Forums » Developers, developers, developers » Web design and development » Form that creates a pre-made web page

    Author
    Topic
    #464874
    Code:
        
    
    
        
    
    

    Lets say the above is my web page template.
    I would give it to my coworkers, who would then add there content without touching the html command tags.
    Then they would have to save the file with their added content as a .html file.

    I would like to create a form for my coworkers to fill out.
    Referencing to the above code example, this is what the form would look like:
    Web Page Title:
    Page Body Content:

    The user would input their answers into a text box to the right of the Colon.
    The form would also have a Submit button that the user would click once the user had completed entering all the fields.
    The Submit button would insert what the user entered in the fields into the html coding tags, then it would save it as a new html document.

    This way the user could make a web page using my template without knowing anything about html, and without ever seeing the html code.

    I am so desperate to figure out how to make such a form, but I don’t know too much about making forms or how they work.

    Thanks,
    Andrew

    Viewing 34 reply threads
    Author
    Replies
    • #1192130

      I don’t know directly of any code that can do this but if you do a search for PHP Codes you’re almost certain to come across something, or if you use a free editing program such as NVU and get your coworkers to install it as well you can create a master template which they can add content to without any knowledge of HTML being required.

    • #1192342

      Thanks, but I know absolutely nothing when it comes to PHP.

      I have also used a free program called Evrsoft First Page.
      It can be found at: http://www.evrsoft.com/download.shtml

      If someone could attach a sample file that demonstrates what I am looking for, that would be great.
      Then I could dissect it and figure out how to customize it to my liking.

    • #1193796

      Its possible to do this but you have to write an HTML form to do it. You dont mention if you have the knowledge to do that.
      Secondly you need a back-end service such as PHP or Perl to submit the form to and process the data. The PHP or Perl would then process the data by replacing the fields in your form with the data the user enters and saving the resultant string to a file with whatever filename you choose.
      This would be simple to write and test. If you have the knowledge to do it.

    • #1193803

      Unfortunately, I only know HTML, and have made some mailto forms in the past. I don’t know much on PHP, but would I still need to use PHP for this?
      I thought the only reason I would need PHP is if I wanted the end result to be uploaded to the web. I really just want the output to be a text or html file that is saved on the local computer.

      Thanks for the reply.

      • #1193877

        I really just want the output to be a text or html file that is saved on the local computer.

        A long time ago, I wrote an HTML application (.hta, which runs only in IE) which would create a new HTML signature file for Outlook users based on a form they filled out. This was done with VBScript, which is a venerable (okay, “obsolete”) proprietary language that someone in your organization might know. (I might be able to dredge it up as a code sample. Not sure where it is now.)

        == Edit ==

        Here is the application I mentioned, with a few changes to generalize the contact information. If you double-click the .hta, it should launch in IE, although there might be security issues in IE8 (I didn’t test). To edit it, open in Wordpad or your favorite HTML editor.

        • #1195174

          A long time ago, I wrote an HTML application (.hta, which runs only in IE) which would create a new HTML signature file for Outlook users based on a form they filled out. This was done with VBScript, which is a venerable (okay, “obsolete”) proprietary language that someone in your organization might know. (I might be able to dredge it up as a code sample. Not sure where it is now.)

          == Edit ==

          Here is the application I mentioned, with a few changes to generalize the contact information. If you double-click the .hta, it should launch in IE, although there might be security issues in IE8 (I didn’t test). To edit it, open in Wordpad or your favorite HTML editor.

          Thanks a lot for sharing this Jefferson. I’m hoping to learn lots from playing around with this.

    • #1193882

      Thanks, I wasn’t aware that VBScript was obsolete, but then again I don’t know much about programing.
      .hta? HTML Applications, you learn something new every day. I’ll have to research that.

      Any kind of sample program you can send me would be great. Thanks again.

      • #1193885

        Thanks, I wasn’t aware that VBScript was obsolete, but then again I don’t know much about programing.
        .hta? HTML Applications, you learn something new every day. I’ll have to research that.

        Any kind of sample program you can send me would be great. Thanks again.

        Since you now know that you are going to need some back end (i.e. server) code a description of your server envrionment would be helpful.

        What server operating system?

        What web server?

        Joe

        --Joe

    • #1193890

      I use Apache for my Web Server, with Windows XP.

    • #1193924
      Code:
       
      
      
       
      
      

      Lets say the above is my web page template.
      I would give it to my coworkers, who would then add there content without touching the html command tags.
      Then they would have to save the file with their added content as a .html file.

      I would like to create a form for my coworkers to fill out.
      Referencing to the above code example, this is what the form would look like:
      Web Page Title:
      Page Body Content:

      The user would input their answers into a text box to the right of the Colon.
      The form would also have a Submit button that the user would click once the user had completed entering all the fields.
      The Submit button would insert what the user entered in the fields into the html coding tags, then it would save it as a new html document.

      This way the user could make a web page using my template without knowing anything about html, and without ever seeing the html code.

      I am so desperate to figure out how to make such a form, but I don’t know too much about making forms or how they work.

      Thanks,
      Andrew

      Hi Andrew

      Find attached a simple Excel workbook that will create a basic HTML file; Add text to the two “fields” in the spreadsheet and run the Macro. It will create an index.htm file on your C drive

    • #1193938

      Awesome!!! I have just 2 questions on customizing the code though.

      1) Could you explain to me what this means / does?:

      fnum = FreeFile()
      Open MyFile For Output As fnum

      2) If it is not too difficult and if possible, could the spreadsheet contain
      a submit button that would start the macro? It is not important though.

      Thank you so so so very much!
      The spreadsheet form that you created seems very easy for me to
      customize the code, and is very easy for the end user to work.
      I feel like I received an early Christmas present!

    • #1193939

      FreeFile is a function returns an Integer value representing the next file number available for use by the FileOpen function. The Open statement requires a filenumber argument in the range 1 to 511 and so FreeFile returns such a number that is not already in use.

      I have attached Version 2

    • #1193942

      So in other words, the form is creating / opening a file called index.html. If the program was dealing with more than one file than things could get confusing, so you use FreeFile to simplify / automate this. Tell me if what I just said makes any sense.

      Thank you. I certainly owe you one.

    • #1193943

      Correct, It is assigning a number for the file so that it can open it then print a line of text (in this example we are writing tags that a browser can decode).

      If you want a number of files to be updated then using Excel we could put some simple logic into it as the FreeFile is closed at each session

    • #1193951

      Where could I learn more on this coding? Is it just VBasic?

      I see your wearing a Santa hat, so a very Merry Christmas to you.

    • #1193964

      Would you belive I learnt the very basics at Collge when I retrained mainly in Access but then learnt the rest from the Lounge over the past 7-8 years

    • #1194699

      Hello again and Happy New Year to all.

      I was wondering if there is a way to set a limit to the amount of characters that can be inputted into a specific field.

      Thanks again.

    • #1194723

      Try this one; there are two options.

      Option 1 truncates the text reducing it to a set length and adds an elipsis at the end. Option 2 creates a message box that checks the length and asks them to reduce the string length.

    • #1194765

      I only noticed that a message popped up after hitting the button telling me to make it less than 250 characters.
      Please see attached example.
      Thanks.

      • #1194777

        I only noticed that a message popped up after hitting the button telling me to make it less than 250 characters.
        Please see attached example.
        Thanks.

        Hi Andy

        Have a look at the code in my file as I have commented out OPTION 1 so that you can see how they work

        Code:
        Sub CreateHTML()
         Dim strTitle As String
         Dim strBody As String
         Dim MyFile As String
         Dim intMaxlength As Integer
         
         
        strTitle = Cells(5, 2).Value
        strBody = Cells(8, 2).Value
        intMaxlength = Len(Cells(8, 2).Value)
        '#############OPTION 1#####################
        'If intMaxlength > 250 Then
        
        'strBody = Left(strBody, 247) & "..."
        'Else
        'End If
        '##########################################
        
        '#############OPTION 2#####################
        If intMaxlength > 250 Then
        
        MsgBox "You are only allowed a maximum of 250 characters in" & vbCrLf _
        & "please reduce the description in size"
        Range("B8").Select
        Exit Sub
        Else
        End If
        MyFile = "c:" & "index.htm"
        
        fnum = FreeFile()
        Open MyFile For Output As fnum
        
        Print #fnum, "" & vbCrLf & ""
        Print #fnum, "" & strTitle & ""
        Print #fnum, "" & vbCrLf & ""
        Print #fnum, strBody & vbCrLf & "" & vbCrLf & ""
        
        Close #fnum
        
        End Sub
        

        PS I am not sure what I am looking at in the Word document!

    • #1194809

      I understand the code that you provided for option1, only it doesn’t work for me.
      Anyway I don’t even want it to add “…”
      I just want it to stop when it gets full.

    • #1194840

      Ok, I just noticed you post script, sorry.

      The word document that I attached simply has a text form field. If you type in the form field the text will stop when you come to the predetermined limit. For example if the text field had a limit of 7, and you typed the word “description”. This is what you would get:
      descrip
      Even if you were to continue typing the word “description”; “descrip” is all that would fit and therefore all that would appear in the field.

      Thanks again, and hope this explains it better.

    • #1194865

      I have just realised I have been over complicating this, why not just use Data Validation to check the string length in Cell B8. Have a look here on how to set it.

    • #1194872

      I applied data validation to the cells so that the text limit was set to “less than or equal to” 15. Only problem is it still allows you to continue entering text beyond 15 characters. The only difference is if you clicked away from that cell, a message would tell you that it is an invalid entry because of the text limit. You still have to go an shorten it yourself. Not quite the way it works in a Word form. Why isn’t it as easy as setting the cells properties as I did in the example Word file “Form Field Limit.doc” I provided before.

    • #1195062

      Please let me know if you understand my last post, thanks.

    • #1195064

      I did and what you want is not possible at Cell level in an Excel worksheet however it can be done in an Excel for. Been a tad busy here so you will have to be patient.

    • #1195074

      The attached Workbook allows a maximum Title of 50 characters and the Body a maximum string length of 1000. These were arbitrary values choen by me but you can change them in the Properties of the object under maxLength.

    • #1195084

      Sorry, I didn’t want you to thing I was being impatient. I just wanted to make sure you got my last post.
      Since I am fairly new to this forum it is hard for me to keep up with new posts in threads.

      Anyway, you have amazed me yet again! How did you do that, it looks like a program scripted in C++, only it is in excel. I only wish it was just a program, but then I guess it would be much harder to customize it, correct?
      Thanks, I just hope I will be able to customize it.

    • #1195132

      It is standard VBA but uses the Forms objects in the Editor. If you are totally new to the Excel environment, yes it will be a little more difficult but the underlying code hasn’t changed (much) it just references objects on the form rather than on the worksheet. What would you like to customise?

    • #1195167

      I have been following this thread with interest, and really like Jezza’s latest offering of an excel userform. I have sliced and diced it (for my own educational purposes) and understand the set-up entirely. Thanks for the lesson!

      I am interested to know whether this could be achieved in a stand alone application, outside of excel? If so, if anybody could provide a simple example file so that I can continue my new year education.

    • #1195265

      It is standard VBA but uses the Forms objects in the Editor. If you are totally new to the Excel environment, yes it will be a little more difficult but the underlying code hasn’t changed (much) it just references objects on the form rather than on the worksheet. What would you like to customise?

      I believe I will be able to figure the coding out for the most part to customize it, I just need to find the time to learn it.
      One thing I know I will want to do in the form was mentioned in a previous post that can be found here: http://bro.ws/769717L

      I have been following this thread with interest, and really like Jezza’s latest offering of an excel user form. I have sliced and diced it (for my own educational purposes) and understand the set-up entirely. Thanks for the lesson!
      I am interested to know whether this could be achieved in a stand alone application, outside of excel? If so, if anybody could provide a simple example file so that I can continue my new year education.

      I am glad this thread has brought interest to you. I am also interested in having a form like this in a stand alone application too, but I think I will settle for having it work inside of excel because I believe it will be easier to customize.

      Thanks a lot for sharing this Jefferson. I’m hoping to learn lots from playing around with this.

      I played around with the form that Jefferson created, and I like his as well. Can’t I just delete the scripting to that and insert the scripting that Jezza used. This way it will work without the need for excel. Please let me know, and thanks for the info I wasn’t aware that Jefferson had edited his last post and attached a sample.

      • #1195284

        I played around with the form that Jefferson created, and I like his as well. Can’t I just delete the scripting to that and insert the scripting that Jezza used. This way it will work without the need for excel. Please let me know, and thanks for the info I wasn’t aware that Jefferson had edited his last post and attached a sample.

        I am almost certain that the vba code from Jezza’s userform could be incorporated into a HTML application (like the one Jefferson posted), or something similar. I am playing as we speek, so will keep you posted. If I am wrong, I hope a more experienced lounger will jump in and save me the pain of being proven wrong.

        OTOH, I’m not sure whether the “maximum string length” requirement could be incorporated?

    • #1195290

      Thanks,
      Your “OTOH” is a perfect example, or reason why this has been making me crazy from bouncing all over deciding what route to go with. I mean I want features “A, B, and C”, but if I use “Program 1” which is only compatible with “scripting code X”, then I can only have features “A and B”.
      Fairly often when dealing with computers it can be hard to know where to start or who to ask for help because of this.

    • #1195416

      No success thus far, but I’ll keep plugging away when I have time spare. I’m on a spring clean manic mission currently, but i’ll have another play later.

      .hta appears to be somewhat outdated, but still possibly adequate I did rather a lot of reading last night on the subject and was viewing online .hta examples (google it). Some interesting stuff, all of which is new to me!

    • #1195572

      Thanks for the update, I have been busy lately with some other stuff,
      so I didn’t get around to “playing” with the code or learn about .hta files.

    • #1205061

      Hello,
      I am trying to take Jezza’s visual basic coding from the excel file and create an .exe file using visual basic.
      I don’t know if I can do this, but I assume that since they both use visual basic, that it could be possible.
      Any help would be great. Thanks.

      • #1205108

        Hello,
        I am trying to take Jezza’s visual basic coding from the excel file and create an .exe file using visual basic.
        I don’t know if I can do this, but I assume that since they both use visual basic, that it could be possible.
        Any help would be great. Thanks.

        Andy, I am happy to help but it is difficult without knowing roughly what you want exactly as my first offerings were Proof of Concept. How about sending us what you have or code snippets that we can get our teeth into.

        If it is application specific we can move it to that relevant board as we can tap into more expertise in that area. Don’t worry about the standard of your code us regulars are very forgiving.

    • #1205171

      I really just wanted to make the form you made in excel work without needing excel.
      Like a standalone .exe program. I understand the visual basic code, but I am new to Microsoft Visual Basic,
      and I just wanted to copy your code and paste it into Visual Basic.
      And then I would change the code to my liking.

    • #1205242

      Hi Andy,

      I am going to need to take a back seat on this one I’m afraid as my experience in insufficient in this area. I am hoping that Jerry or another lounger will be able to assist you, I will be looking on and hoping to learn from it as I am very interested in this type of thing. I just never know where to start…..

      Goog Luck

      Nathan

    • #1205431

      Thanks, I am hoping too….

    • #1205627

      I downloaded Microsoft Visual Basic 2008 Express Edition. I am trying to input Jezza’s coding into it, but I am having 2 problems:
      1) I don’t know how to view Jezza’s Code from Microsoft Excel.
      2) I don’t know where to paste Jezza’s Code into Microsoft Visual Basic 2008 Express Edition to make it into an .exe program.
      Jezza’s Excel file that I am referring to can be found here: createHTMLv4

      Any help on this would be greatly appreciated.
      Thanks,
      HandyAndy

      • #1209393

        I downloaded Microsoft Visual Basic 2008 Express Edition. I am trying to input Jezza’s coding into it, but I am having 2 problems…

        This seems to have changed from a web development question to a Visual Basic question. Also, I can’t find Jezza’s XLS file in this thread. If you wish to pursue this question, I suggest starting a new thread with all the relevant (but none of the irrelevant) information on the Windows Programming forum.

    Viewing 34 reply threads
    Reply To: Form that creates a pre-made web page

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: