Is there anyway I can make a textbox read-only?

Posted on 2011-10-17
Last Modified: 2012-05-12
I have a webpage that I am sending a GUID to from a desktop app (

Is there anyway I can make the PayPal on0 textbox read-only so the user doesn't farkel with it?
function getParameterByName(name)
  name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
  var regexS = "[\\?&]" + name + "=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(window.location.href);
  if(results == null)
    return "";
    return decodeURIComponent(results[1].replace(/\+/g, " "));

<form id="myform_id" action="#">
<td><input type="image" src="" border="0" name="submit" /><td style="font-size: smaller;">
<input type="hidden" name="on0" value="GUID">&nbsp;&nbsp;&nbsp;&nbsp;GUID:</td>
<td><input type="text" name="os0" maxlength="100"></td>
<td><img alt="" border="0" src="" width="1" height="1"></td>
var usersGUID = getParameterByName('GUID');
document.forms['myform_id'].elements["os0"].value = usersGUID;

Open in new window

Question by:rmmarsh
    LVL 82

    Accepted Solution

    Yes, see here:  But you may have to use javascript to make it 'readonly' after you put the value in it.

    Author Comment

    Interesting... when I use 'readOnly' or 'disabled', the value does NOT get sent on to PayPal... any ideas why?
    LVL 82

    Expert Comment

    by:Dave Baldwin
    'disabled' is not supposed to be sent.  I would have thought that 'readonly' would work.  It does work in the demo on the link above.  And it works on my own demo pages so I guess you need to check your code.

    Author Closing Comment

    Thank you...
    LVL 82

    Expert Comment

    by:Dave Baldwin
    You're welcome, glad to help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
    In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now