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.

How to do this in HTML?

Discussion in 'HTML & Website Design' started by campolar, Jul 13, 2008.

  1. #1
    If i hav an INPUT field, is it possible that the field is only half editable. I mean like this:
    [blah for you] where the user can only edit "blah" and the rest stays as it is. I know how to add value and disable the field. But is it possible that its only semi-disabled? And the requirement is that, when the form (where the input field is) POSTs the input(s), it only posts the editable "blah" and not the rest of " for you"????

    Whoever can help me gets a small reward (will be told via PM :D)
     
    campolar, Jul 13, 2008 IP
  2. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #2
    You'll need to add javascript or PHP.

    The text field cannot be modified to only edit a portion. It can be disabled and shown or it can be enabled and fully edited.

    An example of what I'm talking about with javascript or php is

    The user enters the site and enters their name in an input box. On submitting they're redirected to a different page where it says Name, Welcome to the Site!

    Is this what you're trying to do?
     
    rebelagent, Jul 13, 2008 IP
  3. Licensescript.com

    Licensescript.com Well-Known Member

    Messages:
    287
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #3
    Javascript, If you google it there are free scripts like this.
     
    Licensescript.com, Jul 13, 2008 IP
  4. campolar

    campolar Peon

    Messages:
    2,683
    Likes Received:
    244
    Best Answers:
    0
    Trophy Points:
    0
    #4
    no i'm not trying to get the user to a different page. Yes maybe javascript is required here, but can u read the thread carefully and tell me wat to do?
     
    campolar, Jul 13, 2008 IP
  5. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #5
    I did read it carefully and to my knowledge which I feel is quite vast in HTML, this is not possible.

    You can also have a user submit a name and it appears on the same page without reload. It's available through javascript, maybe dhtml, and ajax.
     
    rebelagent, Jul 13, 2008 IP
  6. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Yes, you can do that with CSS alone!
     
    rohan_shenoy, Jul 13, 2008 IP
  7. amazingronit

    amazingronit Well-Known Member

    Messages:
    1,334
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #7
    wow! would you care to tell us how???? I am developing websites for 6 years from now and i still have no idea how to do this with css alone! you must be a genious!!!:cool:
     
    amazingronit, Jul 13, 2008 IP
    rebelagent likes this.
  8. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #8
    LMFAO I'm adding green for that. I agree with you. He must be a programming god who re wrote the CSS bible.
     
    rebelagent, Jul 13, 2008 IP
  9. amazingronit

    amazingronit Well-Known Member

    Messages:
    1,334
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #9
    thank you rebelagent. maybe rohan_shenoy is going to take css coding to new heights. three cheers for rohan!! you're the man!you might land up working for google labs after a google guy sees this thread.

    @campolar,

    do you want the disabled text to be sent with the form or to actually show up on the text box itself? if it is only to show up on screen, i suggest you to make two adjacent text boxes and two separate css classes for them so that the borders are on opposite sides and they appear and behave as a single text box. then write your "bla" on one and disable it. hope it helps.
     
    amazingronit, Jul 13, 2008 IP
  10. campolar

    campolar Peon

    Messages:
    2,683
    Likes Received:
    244
    Best Answers:
    0
    Trophy Points:
    0
    #10
    so care to tell us how to do in CSS???

    PLEASE???
     
    campolar, Jul 13, 2008 IP
  11. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #11
    Wish I could rep you again, I didn't think of that. That's pretty dang smart. Well he could just disable the 2nd part and it still can submit though. On the process code for the form he could insert the extra manually.

    A bit like the finished portion of an email form where it says Thank You, Name.

    I'd go with that option campolar. Or you could just show us what you're doing so we can get a better picture.
     
    rebelagent, Jul 13, 2008 IP
  12. campolar

    campolar Peon

    Messages:
    2,683
    Likes Received:
    244
    Best Answers:
    0
    Trophy Points:
    0
    #12
    campolar, Jul 13, 2008 IP
  13. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #13
    Yeah give me a few minutes to write it up.
     
    rebelagent, Jul 13, 2008 IP
  14. campolar

    campolar Peon

    Messages:
    2,683
    Likes Received:
    244
    Best Answers:
    0
    Trophy Points:
    0
    #14
    sure...just waiting :)
     
    campolar, Jul 13, 2008 IP
  15. amazingronit

    amazingronit Well-Known Member

    Messages:
    1,334
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #15
    ok. by the time rebelagent jots down the codes for this one , please see your other thread. i've replied on it. and i am still waiting for rohan to show up ;)
     
    amazingronit, Jul 13, 2008 IP
  16. NickL

    NickL Peon

    Messages:
    10
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I don't have time to give you exact code, but here is the basic jist of two ways you could do it. Perhaps this will help get you pointed in the right direction.

    1. If you are just doing a "fill in the blank", you could have your input field first and then your static text as just HTML. Like this:


    <form><input type="text" value="blah" ...> For You. .... {rest of html...}

    Or

    2. Use java script to edit the text as the user types, or right after the user leaves the field.

    <input type ="text" id="inpUserText" onkeypressed="processKey">

    The JavaScript would do something like:

    .... hmmm... I need to know some things first. Will the input box have the text "for you" in it when they enter the field? When they start typing is it ok to eliminate the "for you" and then have it be put at the end of whatever they type after they leave the field? OR - Do you want the "for you" part to always be in the input box while they are typing?
     
    NickL, Jul 13, 2008 IP
  17. campolar

    campolar Peon

    Messages:
    2,683
    Likes Received:
    244
    Best Answers:
    0
    Trophy Points:
    0
    #17
    i want the "for you" part inside the input field and they can only edit behind it, not "for you" itself or type forward to it, only before it.
     
    campolar, Jul 13, 2008 IP
  18. campolar

    campolar Peon

    Messages:
    2,683
    Likes Received:
    244
    Best Answers:
    0
    Trophy Points:
    0
    #18
    I tried everything but its not working. I haven't tried wat amazingronit said. Can somebody please explain how to do it?
     
    campolar, Jul 14, 2008 IP
  19. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #19
    Hi, Rohit, here it is!
    I have read your reply, the basic logic is same as you thought of, but while displaying, the borders of the text fields do not align properly and hence you must set all borders for the text fields to none and then wrap the text fields in a span and set inset borders for that span.

    Pick the complete snippet from http://www.w3hobbyist.com/2008/07/semi-disabled-form-text-fields-with-css/
     
    rohan_shenoy, Jul 14, 2008 IP
  20. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #20
    @rebelagent, Instead of disabling the field, you should set it to readonly when you wish to have it passed to the server, unlike 'disabled'.
     
    rohan_shenoy, Jul 14, 2008 IP