power-media / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

TActiveCustomValidator CallBack problem #103

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a page with a TTextbox and TActiveCusctomValidator for it. Of
course you will need a TButton also.
2. Type a valid word (you must do the logic) and click the submit button.
3. You will need to click once again in order to submit the form.

What is the expected output? What do you see instead?
If the form is valid, it should be submitted without need of clicking twice.

What version of the product are you using? On what operating system?
PRADO 3.1.4, Ubuntu 8.10

Please provide any additional information below.
Browser: Mozilla Firefox 3.0.5
Web server: lighttpd 1.4.18

Original issue reported on code.google.com by gacev...@gmail.com on 22 Jan 2009 at 4:30

GoogleCodeExporter commented 8 years ago

Original comment by Christophe.Boulain@gmail.com on 29 May 2009 at 11:54

GoogleCodeExporter commented 8 years ago
Move to 3.1.7

Original comment by Christophe.Boulain@gmail.com on 22 Jul 2009 at 8:15

GoogleCodeExporter commented 8 years ago
Can't reproduce issue, works as expected with PRADO 3.1.6 on WinXP Apache 2.2.x 
/
nginx0.7.x in Firefox 3.0.11 & 3.5.5, IE 8, Safari 4, Chrome 3, Opera 9.6
Maybe the callback takes a little longer, you should verify this using Firebug!?

Test:
<com:TActiveTextBox ID="TextBox1"
    ValidationGroup="Group1" />
<com:TActiveButton Text="Submit" ValidationGroup="Group1"
    OnCallback="buttonClickedCallback"
    ActiveControl.EnableUpdate="true"/>
<com:TActiveCustomValidator
    ValidationGroup="Group1"
    ControlToValidate="TextBox1"
    OnServerValidate="serverValidate"
    ActiveControl.EnableUpdate="true"
    Text="You must enter 'test'"/>

public function serverValidate($sender, $param) {
    if($param -> getValue() !== 'test')
        $param -> setIsValid(false);
}

public function buttonClickedCallback($sender, $param) {
    if($this -> getIsValid())
        $sender -> setText('Success');
}

Original comment by GODZilla...@gmail.com on 8 Nov 2009 at 9:13

GoogleCodeExporter commented 8 years ago
See the discussion at http://www.pradoframework.com/forum/index.php?topic=6782.0

Original comment by rojaro@gmail.com on 16 Mar 2011 at 7:41

GoogleCodeExporter commented 8 years ago
Issue 60 has been merged into this issue.

Original comment by rojaro@gmail.com on 16 Mar 2011 at 7:42

GoogleCodeExporter commented 8 years ago
related comment: 
http://www.pradoframework.com/forum/index.php?topic=6782.msg57217#msg57217
I'm attaching a patch that enables "postback after validation callback" to fix 
the problem when using a TButton with a TActiveCustomValidator

Original comment by ctrlal...@gmail.com on 27 Apr 2011 at 12:11

Attachments:

GoogleCodeExporter commented 8 years ago
Although your fix looks somewhat weird to me and in absence of a better idea on 
my side, i've just applied your patch to the trunk (r2889).

Thanks for contributing :-)

Original comment by rojaro@gmail.com on 27 Apr 2011 at 6:57

GoogleCodeExporter commented 8 years ago
This patch destroyed some of our forms. Usually we are combining multiple 
Validators for a single button (see attached sample).

I reverted the patch and everythink worked fine again. (Prado 3.1.9)

Original comment by thomas.h...@gmail.com on 28 Jun 2011 at 1:31

Attachments:

GoogleCodeExporter commented 8 years ago
I don't fully get your code, the php part seems to have been cutpasted and 
refers to 
$this->selectBrand that doesn't exist. Thus, a generation will be emitted and 
$param->Value will be always set to false, triggering the 
TActiveCustomValidator.

Anyway, if i get the problem, you're attaching 2 validators (one required field 
and another to check the actual value) to a TTextBox.
I've modified a bit your example and created a testcase. It seems to work here 
using the following procedure:
1) push the button => both validators triggers their error
2) enter 'a' in the textbox and push the button => only the 
TActiveCustomValidator error gets shown
3) enter 'Prado' in the textbox and push the button => Postback gets executed
Can you reproduce the error on this example? if yes, please report the 
modifications and the procedure you're following.

Original comment by ctrlal...@gmail.com on 28 Jun 2011 at 3:58

Attachments:

GoogleCodeExporter commented 8 years ago
Yes the code was cutpasted and cleaned up ;-). I've successfully tracked down 
the error. It happens if you use a template based layout. 

In the template file "MyTemplate.tpl" there is a TContentPlaceHolder which 
references to the TContent with the ID "main". The Content Element is defined 
in the "Home.page" file. If i look at the source code of the page the ID of 
inputIdentifier gets extendet to "ctl0$main$inputIdentifier". As a conclusion 
the javascript code gets altered too, but i think there is a problem with the 
id reference (alters between ctl0$main$inputIdentifier and 
ctl0_main_inputIdentifier). Attached you can find e a comparison of the old an 
new source code (pagesource.txt).

I've also altered the helloworld sample to produce the error. There are two 
behaviours:

*) Behaviour A (Problem)
1) Enter 'Prado' and click directly on "Execute transaction" - the page will 
refresh,
but nothing happens at all.

*) Behaviour B (Working as expected)
1) Push the button - both validators trigger
2) Enter 'Prado' in the textbox and press the tab button - the validators will 
disappear
3) Push the button - the message "executeTransaction ok" is being displayed 
correctly

Thank you for your fast reply!

Original comment by thomas.h...@gmail.com on 29 Jun 2011 at 10:48

Attachments:

GoogleCodeExporter commented 8 years ago
I'd reworked the previous patch a little to address this issue and committed it 
on trunk/ as http://code.google.com/p/prado3/source/detail?r=3006 . It fixes 
your testcase in my tests. Can confirm that it's working for you too? i'd like 
to backport it on the 3.1 branch.

Original comment by ctrlal...@gmail.com on 2 Jul 2011 at 1:56

GoogleCodeExporter commented 8 years ago
I've applied the patch and tested it within three different installations. Now 
everything is working as expected again. Great! :)

Original comment by thomas.h...@gmail.com on 6 Jul 2011 at 11:56

GoogleCodeExporter commented 8 years ago
patch backported in r3008, thank you!

Original comment by ctrlal...@gmail.com on 6 Jul 2011 at 12:50