CodeChargenewbie
Posts: 114
|
| Posted: 01/22/2008, 2:21 PM |
|
How do I use the validation rule property? I know I can do on validation event on a control or form and accomplish what I wish in that fashion. But how do I enter code in the validation rule properties window? I'm using PHP. I'm trying to do something like this:
if($Form->ControlName->GetValue() != ""
Then, in validation text, I'd write "Please Enter some data" (without quotes). How the heck do I use this property???
Thank you.
|
 |
 |
DonB
|
| Posted: 01/23/2008, 5:48 PM |
|
I don't use it myself, always seem to end up putting in a validate() event.
But fill in the property and see what the code generates. One thing I
suspect is you have to reference $this->ControlName->GetValue() or
$this->GetValue, just because of the context in which the validation rule is
used. It's different that when your inside an event handler.
--
DonB
http://ccswiki.gotodon.net
"CodeChargenewbie" <CodeChargenewbie@forum.codecharge> wrote in message
news:247966c56edfef@news.codecharge.com...
> How do I use the validation rule property? I know I can do on validation
> event
> on a control or form and accomplish what I wish in that fashion. But how
> do I
> enter code in the validation rule properties window? I'm using PHP. I'm
> trying
> to do something like this:
>
> if($Form->ControlName->GetValue() != ""
>
> Then, in validation text, I'd write "Please Enter some data" (without
> quotes).
> How the heck do I use this property???
>
> Thank you.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
CodeChargenewbie
Posts: 114
|
| Posted: 01/24/2008, 8:39 AM |
|
I know how to use it now!
Thank you. I looked at the generated code for validation and saw exactly what it does. it already adds an if statement, and it refers to the form using the $this variable. So, as an example, to validate if a control value is set to "A", then issue an error statement, I'd do the following:
In Validation Rule, I'd type $this->Control->GetValue() == "A"
In Validation Text, I'd type "A" is not valid
if you go into the generated code, it reads:
if(! ($this->Control->GetValue() == "A")) {
$this->Control->Errors->addError("\"A\" is not valid");
Glad I finally figured out how this feature works. I wish Codecharge would come out with a huge, comprehensive book, explaining every single detail there is to know with plenty of examples and explanations -- it would make life a lot easier for its users :)
|
 |
 |
|