New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disabled TextBox could't updated #688
Comments
What is actually updating the text field? Are you databinding the TDataGrid again? |
i set the new values via javascript. This works fine. I can see the new value in my browser. |
This is the command to save the new value to the db: $version_save_rec->Kategoriestufe2 = trim($param->Item->Kategoriestufe2ht->Kategoriestufe2tx->Text); and in an echo before, I see that in $param->Item->Kategoriestufe2ht->Kategoriestufe2tx->Text is the old value |
Just a guess, but the main change between prado 3.2 and 3.3 was the use of jQuery instead of protoype. Since prado 3.3, jquery's serialize() is used to collect form inputs when sending ajax requests; serialize() is known not to collect disabled inputs (see https://stackoverflow.com/questions/4748655/how-do-i-make-serialize-take-into-account-those-disabled-input-elements), but a few workarounds exist:
|
I've tried readonly befor I wrote this issue. But it didn't work anyway. So, I'll try the serialize()-workaround. |
Here's the line you may want to patch: https://github.com/pradosoft/prado/blob/prado-3.3/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js#L301 |
You may want to change the code as follows: if(this.options.PostInputs != false)
{
var form = this.getForm();
var disabled = form.find(':input:disabled').removeAttr('disabled');
var params = jQuery('input, select, textarea').serialize() + '&' + jQuery.param(data);
disabled.attr('disabled','disabled');
return params;
} else { Note: i did not test the code, it may contain typos |
mhh.. try |
yes. this works without typeerror. |
Nice, I'll get the fix and a testcase ready during the weekend, time permitting. |
for the fist tests, it looks fine. I'll do some further tests and come back to you end of next week. |
I've nothing heared from my customer. So I think it's fine and works well. |
Looking again at this bug, i don't think it's a good idea to change this behavior.
- if (!$this->getReadOnly() && $this->getText() !== $value) {
+ if ($this->getText() !== $value) {
$this->setText($value);
|
ok, thanks for the information. class TCategoryTextBox extends TTextbox
{
public function loadPostData()
{
parent::loadPostData();
if (!$this->getReadOnly() && $this->getText() !== $value) {
if ($this->getText() !== $value) {
$this->setText($value);
}
}
}
} |
It's probably easier to just trick TTextbox this way: <?php
class YCategoryTextBox extends TTextBox
{
public function loadPostData($key, $values)
{
$this->setReadOnly(false);
parent::loadPostData($key, $values);
$this->setReadOnly(true);
}
} Save it somewhere in the application, eg. as <com:TClientScript>
function makeid() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 10; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
$('#<%= $this->txtOrig->ClientID %>').val(text);
return false;
}
</com:TClientScript>
<com:Application.Common.YCategoryTextBox ID="txtOrig" ReadOnly="true" />
<button onclick="return makeid()">change text</button>
<com:TActiveButton ID="cmdSendText" Text="send text" OnCallback="cmdSendText" />
<com:TActiveLabel ID="labResult" /> public function cmdSendText($sender, $param)
{
$this->labResult->Text=$this->txtOrig->Text;
} |
Hello, thanks for your support. Think, I've got it. First tests were successful. Thanks and regards |
Hello,
after updating from 3.2.4 to 3.3.2 the update of a disabled input textfield won't work any more.
This is the code:
If I set in the TTextBox "Kategorystufe2tx" enabled to true, it will work again.
What's happen or what do I have to change to get the old functionality?
Thanks and regards
Juergen
The text was updated successfully, but these errors were encountered: