SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multi-Step Form - Non-editable fields?

    Hello.

    I am trying to create a multi-step form. On Step 2, I would like to have certain fields captured from Step 1 to display, but not be editable. I have the display part down, but can't seem to get these working. I tried textarea (might have been doing it wrong?). Any suggestions?

    Thanks.
    Chris

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can set the readonly attribute.

    eg
    Code:
    <input name="foo" readonly="readonly" value="can't change me">
    You might want to visually style it a bit different to make sure the user doesn't get confused when they can't change the value. For example, grey it out a bit.

    You could also just store the data in hidden input fields, and display the values seperatly as text.
    eg
    Code:
    Name: winnxce<br>
    Address: 123 foo st<br>
    <input type="hidden" name="name" value="winnxce">
    <input type="hidden" name="address" value="123 foo st">

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info and quick reply. Did not know that attribute existed .

    Best,
    Chris

  4. #4
    SitePoint Evangelist simshaun's Avatar
    Join Date
    Apr 2008
    Location
    North Carolina
    Posts
    438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what kind of data you have, but if its important, dont rely on the readonly attribute to keep a user from editing it. Its very easy to use FireBug (and even certain IE programs) to remove that attribute and edit the value, making any validation you had performed before useless.

    If the data must not change at all after Step 1, then I'd use sessions and display the data as plain-text.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good points. Thank you.

    I am creating a 2-step form. The reason for 2-steps are both to increase form fill out by not having to much data on step 1. Basically, step 1 is what services the user is interested (2 questions and some hidden values). On step 2, I ask for name, phone, email, etc., but also have a free for text field. I was thinking of displaying the services as read-only above the text box. I am not opposed to someone making a change here, but thought it was not necessary. I also wanted to leave open to offer additional services, based on the responses from step 1 (down the road).

    I appreciate any advice re: approach, usability.

    Thanks

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To display the inherited field values as text within the current form, do you have to declare a variable for the field value? Can't seem to get this working.

    Basically, I have several hidden fields coming via $_POST from step1 form (HTML Form) to request.php (step 2 form). On step 2, I want to display the services passed from step 1.

    I thought it would simply be:
    {print "You selected $service.";

    Do I need to set:
    $service = $_POST['service];

    Not getting the field value.

    Thanks again.


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
  •