got error in hello world itself

Discuss anything that's related to the Raxan framework

Re: got error in hello world itself

Postby finaxis » Sun Aug 19, 2012 10:08 pm

Yeah, got the secret. Thanks man.
I looked all over the examples but couldn't find one for the callback.
please let know what m I not doing correctly with this!
Here, nothing seems to work without your magic wand ! :?
checkValidity.php.zip
test page for checkValidit
(1.85 KiB) Downloaded 67 times


Also, is there any method to directly bind data to the view which is loaded thru ajax async. currently m using appendToClient(); this works but duplicates the values on page.

Appreciate your efforts.
Thanks and Regards,
Finaxis
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Sun Aug 19, 2012 11:13 pm

Hi,

Try using the callback as shown below:

Code: Select all
       
        function callback(DOMElement $fld,$name,$value,$markInvalid,$invalid)
      {
            $msg = '';
            $elm = $this->find($fld);   
            switch case($name) {
                case 'itemname':       // validate field itemname       
                    if(strlen($elm->textVal()) < 10) {
                    $msg = 'Value must be greater that 10';
                 }
                 break;
                  
           }
          
           return $msg ? $msg :  true; // return true if valid
      }


Also, is there any method to directly bind data to the view which is loaded thru ajax async. currently m using appendToClient(); this works but duplicates the values on page.


The appendToClient() function will append the content to a client-side element. Try using updateClient or replaceClient().

__
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: got error in hello world itself

Postby finaxis » Mon Aug 20, 2012 9:16 am

Raxan is a hidden treasure. till yesterday I wished I could use replace client; only to discover now.

I tried this (exact syntax) It worked great but delivered "1" insstead of the $msg for all the invalid inputs. what's wrong with the code?
Code: Select all
function callback(DOMElement $fld, $name, $value, $markInvalid, $invalid)
      {
         $msg = '';
         $elm = $this->find($fld);
         switch ($name)
         {
            case 'itemname': // validate field itemname
               if (strlen($elm->textVal()) < 10)
               {
                  $msg = 'Value must be greater that 10';
               }
               break;

         }
         return $msg ? $msg : true;
      } // return true if valid


Thanks and Regards,
Finaxis
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Tue Aug 21, 2012 3:46 am

Hi,

You have just discovered a inside the checkValidity() function. I'll have it fixed in the next release.

Here's a another way you can set the validation error from inside the callback function:

Code: Select all
      function callback(DOMElement $fld, $name, $value, $markInvalid, $invalid) {
             $msg = '';
             $elm = $this->find($fld);
             switch ($name)
             {
                case 'itemname': // validate field itemname
                   if (strlen($elm->textVal()) < 10)
                   {
                      $msg = 'Value must be greater that 10';
                   }
                   break;

             }
             
            if ($msg) {
                 //set custom error
                $this->webForm->setCustomValidity($name,$msg);
            }
      }



__
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: got error in hello world itself

Postby finaxis » Tue Aug 21, 2012 10:51 am

Woah ! next release sounds great. When is it likely? if you can share.

Thanks and Regards,
Finaxis.
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Wed Aug 22, 2012 1:58 am

Hi,

I should have a version ready for release later this this.

_
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: got error in hello world itself

Postby finaxis » Wed Aug 22, 2012 6:46 am

Please add a quick option to display "site under maintenance till d/m/y page" which is a minor but very useful user experience to my mind.

eager to have the next release.

Thanks and Regards,
Finaxis.
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Thu Aug 23, 2012 3:18 am

Great idea. I will make a note of it.

Best regards,

__
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Previous

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron