Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2011-10-17
5
Medium Priority
?
169 Views
Last Modified: 2012-05-12
I have a webpage that I am sending a GUID to from a desktop app (appl.com/sandbox.php?GUID=12345).

Is there anyway I can make the PayPal on0 textbox read-only so the user doesn't farkel with it?
<script>
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 "";
  else
    return decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>

<form id="myform_id" action="#">
<table>
<tr>
<td><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_SM.gif" 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>
<td><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></td>
</tr>
</table>
</form><script>
var usersGUID = getParameterByName('GUID');
document.forms['myform_id'].elements["os0"].value = usersGUID;
</script>

Open in new window

0
Comment
Question by:rmmarsh
  • 3
  • 2
5 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 36980971
Yes, see here: http://www.w3schools.com/tags/att_input_readonly.asp  But you may have to use javascript to make it 'readonly' after you put the value in it.  http://www.w3schools.com/jsref/prop_text_readonly.asp
0
 

Author Comment

by:rmmarsh
ID: 36981564
Interesting... when I use 'readOnly' or 'disabled', the value does NOT get sent on to PayPal... any ideas why?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 36981721
'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.
0
 

Author Closing Comment

by:rmmarsh
ID: 36982173
Thank you...
0
 
LVL 84

Expert Comment

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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

810 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