Advanced Search

Results 1 to 7 of 7

Thread: with same IDs(per BLOCK), but in a time one only display:block the other two display:

  1. #1
    Join Date
    Jan 2012
    Posts
    74
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default with same IDs(per BLOCK), but in a time one only display:block the other two display:

    May have in a web page HTML or HTML 5,... 3 DIV BLOCKS within each a <form> etc tags, with same IDs(per BLOCK), but in a time one only display:block the other two display:none (in a time)... can have this many IDs the same???

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,621
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I'm not completely sure what you are asking. If I understand correctly, NO, element id attributes must be unique. Only one element may have any given id; display/visibility doesn't matter.

    If this is not what you are asking, please explain your question more clearly.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  3. #3
    Join Date
    Jan 2012
    Posts
    74
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    YES THAT MEAN... Well i have to use other Technics, so as IDs must be unique ALL either in display:none/block, like other client or server techniques... process one form from 3 different forms(one visible), like in a rent a car project having:
    booking confirm page after a quote:
    book without Register
    book and Register
    book and Social Register

    correct?

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,621
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Will you only process one of the three forms?
    Will you *ever* need to process more than one at the same time?

    If they are exclusive (meaning you'll only ever process one of the three), then you can give the forms / form inputs the same name attributes (names can be the same; ids can not).

    another option would be to simply have one form, and hide the inputs you don't need. for example (IIUC),
    HTML Code:
    <form id="myform">
        <fieldset id="booking">
            <legend>Booking</legend>
            <p>This section is always visible.</p>
            <label>book: <input name="book"></label>
        </fieldset>
        <fieldset id="register">
            <legend>Register</legend>
            <p>This section is visible if the user is going to register,
                and hidden otherwise.</p>
            <label>register: <input name="register"></label>
        </fieldset>
        <fieldset id="social-register">
            <legend>Social register</legend>
            <p>This section is visible if the user is going to "social" register,
                and hidden otherwise.</p>
            <label>social: <input name="social"></label>
        </fieldset>
        <label>Submit the form: 
            <input type="submit" name="myform-submit" value="submit">
        </label>
    </form>
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  5. #5
    Join Date
    Jan 2012
    Posts
    74
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    yes since all results are a booking,... only one form used ever and processed....

    if instead of "id" use "name" (PHP looks "name" attribute only in Post super global correct?) then in javascript use getElementByName("nameAttributeValue').value, correct?

  6. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,621
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by lse123 View Post
    (PHP looks "name" attribute only in Post super global correct?)
    correct

    Quote Originally Posted by lse123 View Post
    then in javascript use getElementByName("nameAttributeValue').value, correct?
    you *could*, but since names are not unique, you'd need to figure out which one you want (since getElementsByName returns a list, not an individual item).

    You can use ids and names together - use the id for javascript functionality, and use the name for processing the form in PHP.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  7. #7
    Join Date
    Jan 2012
    Posts
    74
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    is any way use keyword this with form.nameAttribute.value to get value?

Similar Threads

  1. css help (display: block)
    By imar3l in forum CSS
    Replies: 2
    Last Post: 01-19-2009, 01:21 AM
  2. Display: Block vs. Inline
    By lindsaycb in forum CSS
    Replies: 8
    Last Post: 02-29-2008, 05:08 PM
  3. Replies: 2
    Last Post: 12-08-2007, 01:56 PM
  4. display:block; problem in FF
    By chr15 in forum CSS
    Replies: 2
    Last Post: 11-13-2007, 06:03 PM

Bookmarks

Posting Permissions

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