views:

66

answers:

3

I have a textarea where people can write comments and click a button to post them. The processing is done with AJAX and so I want that as long as the server is processing the user request (and after too), the button and textarea will be blocked for editing/writing/clicking.

It's very similar to how comments on Youtube videos work.

Do you have an idea how to do this? I'm very new to ajax and so I would appreciate a detailed response,

thanks!

A: 

Gal,

You can use update progress to disable buttons or textareas.

http://www.asp.net/Ajax/Documentation/Live/overview/UpdateProgressOverview.aspx

It's the easiest!

Faruz
Thanks Faruz, I'm working with PHP though so would that be a problem?
sombe
Have no experience with PHP, but don't see a reason why not. If you use UpdatePanel, it's the same.
Faruz
A: 

before you make ajax call, in the javascript function from which you will make ajax call, you can grab the textarea or button by document.getElementById('idOfTextAreaOrButton') method and set the disabled property to true.

Ismail
+1  A: 

Its simple Gal, On button click

document.form.myTextArea.readOnly=true;

If you did no one can edit and also you change the color of the textbox

document.getElementById('myTextArea').style.background = "#FF0000";

RSK
Thank you so much!
sombe
The only addition I'd make to this is that readonly needs to be set differently depending on XHTML and HTML - so you'll need to use "true" or "readonly" depending on your doc type.
Sohnee