Jump to content

devilinc

Members
  • Posts

    96
  • Joined

  • Last visited

    Never

Everything posted by devilinc

  1. i forgot to add this "it doesnt seem to work"
  2. the add function with error message comes correctly below the textfield input with the check limit function if it is static value for the checkLimit function 'customer_monthlyamount' => array( 'rule' => array('checkLimit', 1500), 'message' => 'You have exceeded your alotted limit' ) but if it is 'customer_monthlyamount' => array( 'rule' => array('checkLimit', $_SESSION['limit']), 'message' => 'You have exceeded your alotted limit' )
  3. i dont know what i am missing but it doesnt work for me....this is what i put in my model var $validate = array( 'customer_name' => array('valid' => array('rule' => 'notEmpty','message' => 'This field cannot be left blank'), 'unique' => array('rule' => 'isUnique','message' => 'This Customer Name has already been used')), 'customer_monthlyamount' => array('rule' => array('checkLimit', $_SESSION['limit']),'message' => 'you have exceeded your limit'), 'customer_loginname'=>array('valid' => array('rule' => 'notEmpty','message' => 'This field cannot be left blank'), 'unique' => array('rule' => 'isUnique','message' => 'This Login Name has already been selected by a user. Please choose a different login name.'),'customer_loginnameRule-1' => array('rule' => 'alphaNumeric','message' => 'Only alphabets and numbers allowed','last' => true), ), 'customer_email' => array('valid' => array('rule' => 'email','message' => 'Please enter a valid email address'), 'unique' => array('rule' => 'isUnique','message' => 'This email address has already been used')), 'customer_confpassword' => array('rule' => array('minLength','6'),'required' => true,'allowEmpty' => false,'message' => 'Password must have at least 6 characters'),'customer_loginpassword' => array('rule' => array('minLength','6'),'required' => true,'allowEmpty' => false,'message' => 'Password must have at least 6 characters'),'customer_loginpassword' => array('identicalFieldValues' => array('rule' => array('identicalFieldValues', 'customer_confpassword' ),'message' => 'Confirm password must be same as Password')), ); function checkLimit($check,$limit){ return $check['customer_monthlyamount'] < $limit; } but it doesnt seem to work........$_SESSION['limit'] is the value from my function but it doesnt seem to work...... tried beforeSave() too.....here it works for add with my error message displayed but for edit the logic works but no error message displayed... var $validate = array( 'customer_name' => array('valid' => array('rule' => 'notEmpty','message' => 'This field cannot be left blank'), 'unique' => array('rule' => 'isUnique','message' => 'This Customer Name has already been used')), 'customer_monthlyamount' => array('rule' => 'notEmpty'), 'customer_loginname'=>array('valid' => array('rule' => 'notEmpty','message' => 'This field cannot be left blank'), 'unique' => array('rule' => 'isUnique','message' => 'This Login Name has already been selected by a user. Please choose a different login name.'),'customer_loginnameRule-1' => array('rule' => 'alphaNumeric','message' => 'Only alphabets and numbers allowed','last' => true), ), 'customer_email' => array('valid' => array('rule' => 'email','message' => 'Please enter a valid email address'), 'unique' => array('rule' => 'isUnique','message' => 'This email address has already been used')), 'customer_confpassword' => array('rule' => array('minLength','6'),'required' => true,'allowEmpty' => false,'message' => 'Password must have at least 6 characters'),'customer_loginpassword' => array('rule' => array('minLength','6'),'required' => true,'allowEmpty' => false,'message' => 'Password must have at least 6 characters'),'customer_loginpassword' => array('identicalFieldValues' => array('rule' => array('identicalFieldValues', 'customer_confpassword' ),'message' => 'Confirm password must be same as Password')), ); function beforeSave(){ //if(!isset($id)){ if($this->data['Customer']['customer_monthlyamount'] <= $_SESSION['limit']){ $this->data['Customer']['customer_monthlyamount'] = $this->data['Customer']['customer_monthlyamount']; //echo "<font color ='red'>the monthly limit alloted for your deparment is over.sorry you cannot register</font>"; return true; }else{ echo "<font color ='red'>the monthly limit alloted for your deparment is over.sorry you cannot register</font>"; return false; } //} } can you please direct me on the right path?
  4. btw, my add function is not named as add() but instead custmerscreate()
  5. ok now i get the beforeSave() working correctly with my form values still there but my url is changed now....i pass an id also with the url but now the id is not present and hence my function never runs and i get the form with the values entered back to me.........it doesnt save...what am i doing wrong?
  6. i want to check a condition when the user enters a text field input in the form....i want to check that the value doesnt exceed a value already listed...i run this condition before if($this->save($this->data))....what happens on submission is that the condition succeeds BUT the form entries entered by customer gets wiped out completely and he has to enter from scratch....i want on form submit to display an error message and the text fields should retain all the values and better still if the error message comes below the text field with conditional statement.....what do i do??? please help.....saw a beforeSave() ran it but I think I am running it the wrong way....i just enter the conditon test inside beforeSave() written in my model.....but i dont make a call to it in the controller....so could anyone guide me?
  7. i have 3-4 checkbox in my page which when clicked should display data by ajax request in cakephp....currently i do it in a sneaky way where i manipulate the jquery tutorial for link by replacing with checkbox but i face many issues here....i cant know if the checkbox is set or unset....on top of that it takes in the id of a single checkbox at a time irrespective of how many checkbox is set or unset.... there is an ajax->observeField but i dont know how to implement it....any help to get me going?
  8. its solved.....i am sorry about this...feel silly of myself cos model i misspelled my table name.....
  9. i have an edit form to edit values of a table but i dont have an add form for it cos it is the admin details table.....but this edit form doesnt work.....it works like an add form only, because the validation results tells me so.....it says cant add name as it already exists and all...so where am i wrong?
  10. did it with a form....dint use ajax.... and lol....it was solved long back but came here to post a new question...do see it...
  11. i want my checkbox to fire an event to update my page content...i.e. an ajax checkbox...what i read is observeField is only for select dropdowns so then what about checkboxes?anyone has ideas?
  12. i have made a shopping summary page with values written in session and printed them in my view file....i now want an option for the user to update quantity only....if he does it i need to call an ajax function to update my session values but how to go about it?i am clueless in cake.....
  13. i am still wondering how come the file loads from the second time i click without the error that popped up when i clicked the first time??? so where am i wrong??? or is it that modalbox file???
  14. dont have a clue when i look into that line in the file....google chrome gives a line error which gives exception when the file is being loaded.....anyone have a clue?
  15. when my page is refreshed and i click the first time on modal box i get a blank box on screen....if i click again i get my view file....what could be wrong? I checked the error console and this is what i got....hope it might be helpful..... uncaught exception: ModalBox loading Error: TypeError : Effect.Morph is not a constructor
  16. implementing a search functionality with ajax helper...now how do i pass an id present in an array in my ctp file to this search box also present in the same ctp file???i use ajax for search...i need to pass it so that the search function in the controller gets this id as its argument?
  17. i know we can use for no table but in the end this is how i thought of it....to leave catalog as a link to categories so when clicked on catalog it gives the list of categories and then products under categories....so two controllers each for their specific tasks namely categories_controller.php and products_controller.php.....
  18. I am sorry I posted in a haste i want anyone who is managing this site to move it to the application design section
  19. Here is my scenario. I have a tab namely catalogs which has categories and products under it. Catalog is lets say the menu of categories and when we click on category we get to see the products under it. So, Now, do i have to make separate controllers for catalog, categories and products? because i use models for categories and products but not for catalogs
  20. I think the above query does the simple search...thanks for looking though!!!
  21. this is how far i have reached...could anyone advise me if i have written something wrong? $conditions = array( "OR" => array ( "department_name LIKE" => "%".$this->data['Department']['department_search']."%", "department_email LIKE" => "%".$this->data['Department']['department_search']."%" ) ); $search_results = $this->Department->find('all', array('conditions' => $conditions));
  22. I need someone to translate this into CakePHP style....dont want to use normal queries..... SELECT * FROM `departments` WHERE `department_name` LIKE '%hi%' OR `department_email LIKE '%hi%' here i use the email or name from a text field input so i will handle it but if u could just translate this it into cakephp thanks a lot!!!
  23. here is my code for better understanding only the save or not save part if ($this->Customer->save($this->data)) { // $this->redirect(array('controller' => 'realteams', 'action' => 'index')); //$data = $this->paginate('Customer'); $this->redirect(array('action' => '/customerslist/'.$_SESSION['department_id'])); unset($_SESSION['department_id']); ob_flush(); } else { $this->Session->setFlash(__('The Customer could not be saved. Please, try again.', true)); //$this->redirect(array('action' => '/customerscreate/'.$_SESSION['department_id'])); }
  24. i have a form that validates...if validation takes place correctly i just lose my 'id'...this "id" is needed to be passed to my url to save the form values to this particular category of 'id'....if data is correct and no validation required and i submit form i get the id passed to and stores correctly......what do i do?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.