got error in hello world itself

Discuss anything that's related to the Raxan framework

Re: got error in hello world itself

Postby finaxis » Wed Mar 28, 2012 6:35 pm

hey it works !
from my previous post:
$a = embedded jquery script on master template works on ajax (sync) call.
$c = script load via _load works on views loaded with (sync) call.

Still would like to know if it can work on ajax (async) call.

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

Re: got error in hello world itself

Postby raymond » Thu Mar 29, 2012 2:16 am

$a = $this->delegate('#savecontact','#click','.saveForm'); // works perfect but how to autoToggle/autoDisable submit button during the save process.


You can set the autoToggle and autoDisable options as follows:

Code: Select all
$this->delegate('#savecontact','#click',array(
    'callback' => '.saveForm',
    'autoDisable' => true,   // disable the button during event call to server
     'autoToggle' => 'img#pre' // show pre loader
));


$b = can not load dynamic content like $postBackToken via ajax.


I'm not sure I understand the issue. Are you trying to send the content of $postBackToken to the client?
If you would like pass a value to a client side JavaScript function you can use $this->callScriptFn('function_name',$param1);

$c = Is there any way to load a picture in $this->flashmsg or show the count down timer till server responds.


Yes, the flashmsg can take html content. For example:

Code: Select all
$this->flashmsg('Picture example: <img src="myimage.png" />')


Raxan is fun to use. just started enjoying it.


Sounds great! I'm glad you enjoying it :)

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

Re: got error in hello world itself

Postby raymond » Thu Mar 29, 2012 2:20 am

finaxis wrote:hey it works !
from my previous post:
$a = embedded jquery script on master template works on ajax (sync) call.
$c = script load via _load works on views loaded with (sync) call.

Still would like to know if it can work on ajax (async) call.


You can load your scripts using the $this->loadScript() method:

$this->loadScript('jquery');

The $this->addScript() method will not execute scripts when called during an ajax request

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

Re: got error in hello world itself

Postby raymond » Thu Mar 29, 2012 2:27 am

Hi Finaxis,

Just a quick question...

Why is your script taking such a long time (10 secs) to respond? Are you doing any database queries?

My script is taking around 10 secs to respond. I tried loading the script (togglecontent) via _load / _init and also directly on master template but the browser does wanna listen.



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

Re: got error in hello world itself

Postby finaxis » Thu Mar 29, 2012 2:35 pm

Thanks Raymond,
I am doing smtp validation for username (email) , if true then post it to database. is it a good idea? what say !

$a = 'click' and '#click'

e.g. loading contactForm with '#click' into div on master tpl
Code: Select all
**********contactform view e.g field******************
<label for="fromemail">Email Id:<br/>
                  <input name="fromemail" type="email" id="fromemail" required ="required">
                                               <span>Please Enter a Valid Email before send your message</span>
   </label>

 ********************* my js code ******************
$('#fromemail").focus(function()
   {
      var datahelp = $(this).next("span").text();
      $('#userfeed').addClass('info').text(datahelp).fadeIn('slow');
       }
**************js code ends******************************

Place the js code anywhere which ever way- loadscript(file), loadscript inline or embedded hrml. It works for 'click' and does not for '#click'
Any workaround for '#click' !
-->Also, is it possible to do this js work with "$this->delegate" without changing or updating the contact form view. I tried but it refreshes the view onfocus.

$b = token
<input type = 'hidden' name = '_e[tok]' value =" . Raxan::$postBackToken . '" > (ignore syntax)
when I load this programatically with ajax call, it shows up as it is (does not replace with token value). does it not work without session? If feasible, a working example would be great.

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

Re: got error in hello world itself

Postby raymond » Mon Apr 02, 2012 4:49 am

Place the js code anywhere which ever way- loadscript(file), loadscript inline or embedded hrml. It works for 'click' and does not for '#click'
Any workaround for '#click' !
-->Also, is it possible to do this js work with "$this->delegate" without changing or updating the contact form view. I tried but it refreshes the view onfocus


I think your script is not calling the focus event then the view is loaded. Try using $(document).delegate('#fromemail","focus", function() { /* code here */ })

$b = token
<input type = 'hidden' name = '_e[tok]' value =" . Raxan::$postBackToken . '" > (ignore syntax)
when I load this programatically with ajax call, it shows up as it is (does not replace with token value). does it not work without session? If feasible, a working example would be great.


I'm not sure why you need to check compare the token. This is handled by the framework to help prevent cross site request forgery (XSRF)

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

Re: got error in hello world itself

Postby finaxis » Mon Apr 02, 2012 7:07 am

Oh Ok, I thought I need to call the token function.

$this->delegate solved . I used the jquery code instead of using the server side.

but Thanks for being there!
Finaxis.
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby finaxis » Sat Apr 07, 2012 11:21 am

hello Raymond,
small problem this time.
use case: user clicks on email link to confirm token.

the url looks like(localhost...?vu=activeaccount?token=xxxxxxx)
problem : this url persist during ajax calls (afterwards) which is hindering the posting of other forms (loaded with ajax). _activeaccountView() is executed on every form post.

I am trying to achieve:- after click, user should see the confirmation messages and after few seconds gets diverted to login form. This login form is loaded via ajax which does not allow any bookmarking.
I used redirectTo() but then url become (localhost....?vu=login) which can be bookmarked.

Is there any way I can redirect to site url and after redirect use $this->appendView();

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

Re: got error in hello world itself

Postby raymond » Mon Apr 09, 2012 5:10 pm

Hi Finaxis,

the url looks like(localhost...?vu=activeaccount?token=xxxxxxx)
problem : this url persist during ajax calls (afterwards) which is hindering the posting of other forms (loaded with ajax). _activeaccountView() is executed on every form post.


Once you have activated the account you should change the view with redirectToView, otherwise all postback to the page will call the _activateaccountView. To change the postback URL for the page you can set the $this->clientPostbackUrl variable on the page controller.

I am trying to achieve:- after click, user should see the confirmation messages and after few seconds gets diverted to login form. This login form is loaded via ajax which does not allow any bookmarking.
I used redirectTo() but then url become (localhost....?vu=login) which can be bookmarked.


Once you have redirected to the login view the URL will contain the ?vu=login query parameter (unless your using the url router plugin which will then be displayed as page/login)

Is there any way I can redirect to site url and after redirect use $this->appendView();


If the login form is loaded via ajax then you can redirect the user to the main site url and load the login form. The $this->appendView() should only be called during the ajax request.

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

Re: got error in hello world itself

Postby finaxis » Wed Apr 11, 2012 1:34 pm

yeah!
$this->clientPostbackUrl is a just too good.

this vu=login thing works fine but I do not want to allow this login page to be bookmarked. so ajax is the only solution i know. Please suggest how do I avoid bookmarking of login page.

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

PreviousNext

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 2 guests

cron