1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

A strange problem/situation with some particular form

Discussion in 'HTML & Website Design' started by tayiper, Nov 5, 2007.

  1. #1
    Hey all, this time I will write about a confusion in regards to some particular form on my website. You see, as a result of things mentioned in this post of mine in some other thread here on DP forums, I checked the code of some particular form on my website: http://tadejpersic.50webs.com/index.html (please visit it to actually see what I am talking about)


    I am talking about that line/row of buttons, while the problematic one is the first one, which uses an external .js file and which function is to bookmark the current page (the other two buttons with <input type="image" in this line/row are to open a search and contact pages); here below is the original code of the "bookmark page" form:

    <form action="#">
    <input type="button" value="Bookmark us!" onclick="bookmark('http://javascript.internet.com/','JavaScript Source')">
    </form>
    Code (markup):
    Well, and then I checked the code as it is currently on my website, and I noticed that (not sure why/when, but as you can see, this is the only way to show them all in one line; please see below) I changed it so that it looks like (compare to the original "bookmark page" form code above) I forgot to close it with the "</form>" ending tag. So here below is the code of the "bookmark page" form (and I also included the code of buttons that open search and contact pages) as it is on my website, and it surely works as it should, and the page is validated by the W3C checker:

    <form action="#" /><input type="image" src="save.png" title="bookmark page" onclick="bookmark('index.html','Tadej Persic\'s website | index')" />&nbsp;<input type="image" src="search.png" title="search site/web" onclick="window.open('search.html','search','height=560,width=440')" />&nbsp;<input type="image" src="contact.png" title="contact me" onclick="window.open('contact.html','contact','height=560,width=440')" />
    Code (markup):
    But if I change the code to remove the " /> part (i.e. to become ">) and add the closing "</form>" tag as you can see in the first example below, then the "bookmark page" button is placed in its own line above the line/row with the rest of the buttons. Here below are examples of the code of the "bookmark page" form (with the code of buttons that open search and contact pages removed for you to easily see the change); in the first example there's the code as it is after I modified it (i.e. I changed the " /> part to become ">, and added the closing tag, as mentioned above), and as it was/and still is originally on my website:

    <form action="#"><input type="image" src="save.png" title="bookmark page" onclick="bookmark('index.html','Tadej Persic\'s website | index')" /></form>&nbsp;...
    Code (markup):
    <form action="#" /><input type="image" src="save.png" title="bookmark page" onclick="bookmark('index.html','Tadej Persic\'s website | index')" />&nbsp;...
    Code (markup):
    So I am curious: is the form of the code like I modified it afterwards correct, or should I close it with the ending tag "</form>" as it is in the original code (it's an example from some tutorial I guess)of the mentioned form??!


    tayiper
     
    tayiper, Nov 5, 2007 IP
  2. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #2
    OK folks, I already got some feedback here in this thread on WebDeveloper forums. Now I only need to know if I need to put <form action="#"> also to the beginning of others <input type="image" (namely for two buttons that open search and contact pages)??!


    tayiper
     
    tayiper, Nov 6, 2007 IP
  3. niktesla

    niktesla Guest

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    why use form elements?

    is there a reason you have to use form elements?

    seems like all you need are anchor wrapped images with onclick.

    example:
    
    <a href="#" onclick="bookmark('index.html','Tadej Persic\'s website | index')"><img src="save.png" border="0" /></a>
    
    HTML:
     
    niktesla, Nov 6, 2007 IP
  4. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #4
    Oh and of course: beside that I am also interested is it possible to align this "bookmark page" button (after I fix it with "</form>" closing/ending tag of course) to the same line/row with the rest of the buttons as it is aligned/displayed currently (again, see the website linked in the original post) with form not yet fixed??!


    tayiper
     
    tayiper, Nov 6, 2007 IP
  5. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #5
    Ahhh, thanks you soooo much, so if I understand you correctly I don't even need to use form in case of others??! OK then, if this is true then the only question that remains is: is it possible to align this "bookmark page" button to be displayed in the same line/row as the rest of the buttons??


    tayiper
     
    tayiper, Nov 6, 2007 IP
  6. niktesla

    niktesla Guest

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yes it's possible. I think.

    I'm not clear on the question.
     
    niktesla, Nov 6, 2007 IP
  7. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #7
    Well then please take a quick look at the website in question (and page on it, but best would probably be the http://tadejpersic.50webs.com/index.html one) and see the mentioned line/row of buttons for yourself ...


    /UPDATE: Sorry niktesla but I totally missed your reply (i.e. I posted my post before checking if there are any new responses to the previous one)


    tayiper
     
    tayiper, Nov 6, 2007 IP
  8. niktesla

    niktesla Guest

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    It looks proper.

    Is everything working the way you want it?
     
    niktesla, Nov 6, 2007 IP
  9. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #9
    Yes, it indeed looked proper since I haven't actually changed it yet back then (and uploaded to the server), but yeah, luckily I managed to find solutions/fixes to/for most of these things by myself anyway ...


    I only have one question left: what's the difference between, or in other words, is it possible to use <a href="" instead of <a href="#" (and similarly for the form <form action=""> instead of <form action="#">), same as I do to open such popup window below under the "Copyright notice" for the disc link where it says:


    1. Specifically, I've found out that indeed don't need to use form (nor <input type="... of course) for the other two mentioned elements (i.e. for buttons that open the "search" and "contact" pages, beside the one that bookmarks the page, which does require it) in the line/row of the buttons!! Actually, I am not sure why I did use them in the first place.

    Here is the old code:

    <input type="image" src="search.png" title="search site/web" onclick="window.open('search.html','search','height=560,width=440')" />
    
    <input type="image" src="contact.png" title="contact me" onclick="window.open('contact.html','contact','height=560,width=440')" />
    Code (markup):
    And here the new code:

    <a href="#" onclick="window.open('search.html','search','height=560,width=440')"><img class="button" src="search.png" alt="search site/web" title="search site/web" /></a>
    
    <a href="#" onclick="window.open('contact.html','contact','height=560,width=440')"><img class="button" src="contact.png" alt="contact me" title="contact me" /></a>
    Code (markup):

    2. And regarding my other problem (i.e. that there is not possible to align this "bookmark page" button that uses a form with the rest of the buttons), I simply moved this particlar button elsewhere, namely under the title (i.e. <h1> headline) of the respective page.


    But anyway, if anyone does know for a way to do it as it was before (i.e. all the buttons in the same line/aligned to the same row), I would be glad to hear it.


    P.S. - And finally, just a notice on one strange thing. You see, it's that the page in question strangely did validate even before (with one form not propery closed, and with two <input type="... without form "around them"); see for instance the W3C Markup Validator results here: [Valid] Markup Validation of http://tadejpersic.50webs.com/sample/index-old.html for the sample file of the: http://tadejpersic.50webs.com/sample/index-old.html page that still had the mentioned things coded in a wrong manner (and also still had an old layout)


    tayiper
     
    tayiper, Nov 9, 2007 IP