got error in hello world itself

Discuss anything that's related to the Raxan framework

Re: got error in hello world itself

Postby raymond » Tue Apr 17, 2012 2:11 am

Hi Finaxis,

[quote="finaxis"]
...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.
/quote]

Well you could use an iframe to load the content or use it to cloak the url. I personally don't like the cloaking idea but you can check it out here:

http://roshanbh.com.np/2008/04/hide-url ... bsite.html

If you're using an iframe to load the content of the login page then you can also use the overlay() method to display the iframe as a popover.

Code: Select all
$this->findById('iframe1')->overlay();


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

Re: got error in hello world itself

Postby finaxis » Tue Apr 24, 2012 10:18 pm

hello Raymond,
thanks for the last post.

session with raxan

$a = do not want to use file for session handling, use db instead. (how to and how do I use databank feature then)

$b = Raxan::databank is great. but I want to handle 1 session per user across browsers and show alert on next login attempt. I tried using session_set_save_handler (code attached) but can't make it work. Please enlighten me on this.

also any tip/sample code on login / session is humbly requested.

Thanks and Regards,
Finaxis
Attachments
session.zip
(2.36 KiB) Downloaded 143 times
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Wed Apr 25, 2012 2:16 am

Hi,

The quickest thing to do is to use your session_handler class to replace PHP session handler. This can be done by making sure that your Dbase::session()->set_session_handler(); is called before the page is initialied or before any call to the session is made.

My suggession is that it's call at the top of your page:

Code: Select all
<?php

require_once "includefiles.php";

Dbase::session()->set_session_handler(); // setup custom PHP session handler

class MyPage extends RaxanWebPage {
    // code here   
}
?>


Use can then use Raxan::dataBank or Raxan::data() methods to store and retrieve information from PHP $_SESSION object. to remove a entry from the session you can use Raxan::data()

As for a login sample, check out the attached example:

login-demo.zip
(1.63 KiB) Downloaded 140 times


This should provide you with a quick example of how to use the page _authorize() handler.


Have a great day!
__
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: got error in hello world itself

Postby finaxis » Sat May 12, 2012 10:10 am

Hello Raymond,
my use case:
user clicks on submit login button(login form):

c()->confirm("Access to this account is blocked. Would you like to un-block right away ?", _event('ok', null,$this->okShow((string) $this->user['username'])), _event('cancel',null,null));

My problem:
Passing the username from the login form to _event('ok') and _event('cancel') when clicked on the confirm dialogue box(js).

In the above "confirm dialogue" , clicking on 'ok' works great, but click on "Cancel" completes the ok-function and then completes the cancel function.

Please move your magic wand.

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

Re: got error in hello world itself

Postby raymond » Fri May 18, 2012 1:48 am

Hi ,

From what I'm seeing the code for the _even() callback is incorrect. You should use the $this->registerEvent() method to first register the "ok" and "cancel" events. Check out the PHP/HTML Source cde in this example:

http://raxanpdi.com/sdk/examples/example.php?id=popup-box


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 » Fri May 18, 2012 7:14 am

I have already registered both the events in _load(). Problem is not with the event() but, how should I pass the username from login form to 'ok' and 'cancel'?
Code: Select all
$this->registerEvent('ok', '.unblockAccess');
$this->registerEvent('cancel', '.cancelUnblock'); // and then upon submitlogin(if account blocked)
c()->confirm("Access to this account is blocked. Would you like to un-block right away ?", _event('ok'), _event('cancel'));


User's account status is checked once they submit login (loginform)
If user's account is blocked they get the option to immediately unblock it, if they confirm by clicking on 'Ok' (confirm dialogue). In case 'cancel' is clicked, they should receive a notification by email.

For sending email to user -> 'username' from loginform needs to be passed to both 'ok' and 'cancel' funcitons . This is where I am stuck.

Please let know the solution.

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

Re: got error in hello world itself

Postby raymond » Fri May 18, 2012 5:00 pm

You can send the user name to the OK or cancel event by passing it as the second username:

For example:

Code: Select all
c()->confirm("Access to this account is blocked. Would you like to un-block right away ?",_event('ok',$this->user['username']), _event('cancel',$this->user['username']));
.....
protected function unblockAccess($e) {
    $username = $e->textVal();
}


If you don't want to pass the user name in this manner then you can store the username using Raxan::data()

Code: Select all
Raxan::data('lohin-username', $this->user['username']);
c()->confirm("Access to this account is blocked. Would you like to un-block right away ?", _event('ok'), _event('cancel'));
.....
protected function unblockAccess($e) {
    $username = Raxan::data('lohin-username');
}


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 Jul 23, 2012 2:44 pm

Morning Raymond !
Once again I need to hold your finger to keep walking.
checkValidity() is not accepting the user input but passing value (before loading) in html tags is well processed.
I've tried xt-bind, xt-delegate, script-bind-serializecontent, $this->delegate but with the same results. even data-event-value technique delivered the same. please let me know the secret. Here's my code:
Code: Select all
<form action="" method="post" class="form" name='profile_contact_form'  id='profile_contact_form'>
fields....
<button type='submit' class="btn primary sub_" id='submitCoInfo'
              name='submitCoInfo' value='submit' >submit
      </button>
</form>

function _load()
{$this->delegate('#submitCoInfo', #click', array('callback' => 'submitCoInfo', 'autoDisable' => true, 'serialize' => '#profile_contact_form input'));}

submitCoInfo($e)
{
$form = $this->find('#profile_contact_form');
         $form->checkValidity(true);
         $valid = $form->validInputs();
         $invalid = $form->invalidInputs();
rest of the code..
}
// form is not passing the user input but html tag-attribute value like <input type='text' name='fname' value='rambo' > is well taken


Another stack is :- binding template to div inside the view while loading it.
appendTocClient() worked but I have to load it on the master template first and then duplicate the same stuff in the div on the view. do we have any direct way to work with it. code:
Code: Select all
$co = $this->db()->com();
$this->paste->bind($co, array('callback' => array($this, 'rowHandler')))->appendToClient('#coInfo'); // copying '#paste' inside '#coInfo'
         
doesn't work directly,  like
$this->coInfo->bind($co, array('callback' => array($this, 'rowHandler')));
Last edited by finaxis on Tue Jul 31, 2012 9:26 am, edited 1 time in total.
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby finaxis » Thu Aug 02, 2012 8:38 pm

Hello Raymond,
m longing to use this functionality (checkValidity) with all my forms.

checkValidity.php.zip
test page for checkValidity
(1.58 KiB) Downloaded 126 times

Please let know what to do to make it work.
Thanks and Regards,
Finaxis.
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Fri Aug 17, 2012 3:46 am

Hi,

There are two ways to get the checkValidity() method working:

1. Set $this->preserveFormContent = true inside the _config handler
2. Call $this->updateFormFields() inside the event - This update form fields with postback values

I've attached the updated code.

checkValidity.php.zip
(1.21 KiB) Downloaded 132 times

See also http://raxanpdi.com/sdk/docs/data-sanitization.html

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

PreviousNext

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron