Jump to content

jimfog

Members
  • Posts

    1,803
  • Joined

  • Last visited

Everything posted by jimfog

  1. is it possible to access BB view function outside the view definition...inside a jquery click handler for example: Here is a view and a click hendler..the handler is at line 21. I have tried several things before asking here... backbone example
  2. well the code works...I did not expect to work cause I had made some assumptions--which were wrong of course...I have 2 questions though. why not do this with PHP enbedded in the HTML...why resorting to JS...something like this: <div <?php echo ($schedstatus == 1) ? "style='display:none;'" : "style='display:block;'" ?> id="modal">...... I have come to understand that code in a JS file tha resides INSIDE the document on load function...runs after the HTML/document is loaded...that said the modal should be shown(my assumption) and hidden WHEN the code inside the documenton load functions runs. Obviously I miss something but what is that?
  3. I have a textarea form that the user fills to inform why he/she is closing its business...no more than 200 chars. Suppose that he goes to edit that and clicks the cancel button..in such a case whatever he/she has typed must be replaced by the original text. this original text comes from the database and must be available somehwere in the DOM(in case it is needed such as the case of cancel). I was thinking the data attr but for various reasons I do not think you can store there so much text... What are my alternatives?
  4. Depending on a specific value taken from the database....a popup is hidden or shown in a page. The htlm of the popup is there but when the value is true(that comes from the db) with jquery I hide it. That is I get the value in JS....the problem with this approach is that(in case the popup is to be hidden) on page refresh the popup appears for less that a second and then disappears. Bad for UX. How I could make it that when the popup is hidden does not appear at all on refresh. Iis it better maybe to handle it server-side? I hear opinions.
  5. jimfog

    mvc or no mvc

    I am not coding based on MVC...my progect is not big...it works though..ok it is not the cleaner solution...but I am in a tight schedule...is there a compelling reason to change the code to MVC...what do you think?
  6. I am building an app where a table holds business users-businesses data: CREATE TABLE `business_users` ( `crID` mediumint unsigned NOT NULL, `bus_user_type` smallint DEFAULT NULL, `pack_selected` smallint unsigned NOT NULL, `sched_entered` tinyint(1) DEFAULT NULL, PRIMARY KEY (`crID`), KEY `fk_business_users_buz_usertype1_idx` (`bus_user_type`), KEY `pack` (`pack_selected`), CONSTRAINT `fk_business_users_buz_usertype1` FOREIGN KEY (`bus_user_type`) REFERENCES `buz_usertype` (`Type_id`), CONSTRAINT `fk_business_users_users1` FOREIGN KEY (`crID`) REFERENCES `users` (`user_ID`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pack_fk` FOREIGN KEY (`pack_selected`) REFERENCES `packages` (`package_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 In the table above I have ommited some columns for brevity reasons. As you see there is a bus_user_type column....a business user might be for example a doctor a hair stylist a car shop....etc The doctors are a special case cause I must also store theri specialty(dentist,cardioloist etc)....for this reason I have concluded to the following sheme-tell me what you think: CREATE TABLE `doctors_specialties` ( `business_users_crID` mediumint unsigned NOT NULL, `medical_specialties_specialty_ID` tinyint NOT NULL, `speci_ID` mediumint NOT NULL AUTO_INCREMENT, PRIMARY KEY (`speci_ID`), KEY `fk_doctors_specialties_business_users1_idx` (`business_users_crID`), KEY `fk_doctors_specialties_medical_specialties1_idx` (`medical_specialties_specialty_ID`), CONSTRAINT `fk_doctors_specialties_business_users1` FOREIGN KEY (`business_users_crID`) REFERENCES `business_users` (`crID`), CONSTRAINT `fk_doctors_specialties_medical_specialties1` FOREIGN KEY (`medical_specialties_specialty_ID`) REFERENCES `medical_specialties` (`specialty_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 CREATE TABLE `medical_specialties` ( `specialty_ID` tinyint NOT NULL, `specialty_name` varchar(45) DEFAULT NULL, PRIMARY KEY (`specialty_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 In the two above tables I probably must change their names…also see a diagramm of the above tables. diagramm link
  7. You are absolutely right....do not know what I was thinking... This is better now https://jsfiddle.net/fiddlehunt/Lnt74wje/62/ Still I must do it like this-your sugestion is better:
  8. Ι do not get it....do you mean something like this https://jsfiddle.net/fiddlehunt/Lnt74wje/45/ The results are not the desired...
  9. thanks...there is one last detail. when the user clicks the doc radio and then some other radio the search box stays there(unwanted)...AND subsequent clicks of the doctor radio(after clicking othe radio buttons) displays many search boxes in the DOM-besides the doctor radio button. How to tackle these two. I have thought some solutions but I want to hear your opinion.
  10. take a look at this fiddle https://jsfiddle.net/fiddlehunt/Lnt74wje/18/ Select the doctor radio button to see what happens...an input box appears in a place I do not want. I want it to appear right besides the radio button/text...as shown in the image snapshot below I thouht that enclosing the image input/label on a span tag(which is inline element) would the trick...but it does not. Furthermore the label is set to display block by the css code...it is this which creates the problem in the first place. Any ideas...
  11. No it is not found twice in the DB. Meanwhile I made a little search and what finally solved the issue is that intead of tracking keyup I used the input event...that solved it. Follows part of the event handler(JS) so you can understand what I am talking about. $('#search').on('input', function(e) { e.preventDefault(); var searchKeyword = $.trim($(this).val()); if(searchKeyword!=='') {//// tell me what you think...
  12. Make it more clear to me cause I am confused. Are you asking if the name Nikos Pistolou is found twice in the DB... is this what are you asking?
  13. this is the sql query allthough I think the problem does not lie there...the query as you see is rather complex The function that performs the connection to the database is passed in $conn(I can show the code but I do not think is neccesary.) SELECT IF(u.lastname IS NULL,b.comp_name,CONCAT(u.name, " ", u.lastname)) AS name,u.user_ID, t.user_type, b.sched_entered FROM users u JOIN business_users b ON u.user_id=b.crid JOIN buz_usertype t ON b.bus_user_type=t.type_id WHERE u.active = 1 AND b.sched_entered = 1 AND (u.lastname LIKE CONCAT("%",?, "%") OR b.comp_name LIKE CONCAT("%",?, "%"));
  14. probably is a JS issue...relatedd to the event handler
  15. maybe the IF statement must go in the JS code...just thinking.
  16. An IF statement in the sql query or in the php code? I suppose you mean in the PHP code. More importantly what this code will do…I cannot understand…please explain. Here is the code: $arr = array(); if ((isset($_POST['searchKeyword']))&&(!empty($_POST['searchKeyword']))) { $results=search($conn,$_POST['searchKeyword']);//funcction to perform the search operation if($results!==false) { echo json_encode($results);//array με τα αποτελέσματα } else { echo 'false'; } }
  17. I have built an SQL query that when some criteria are met retrieves data from a database and present is to the user as search results....is is a search query in the words. Consider the following when the uset types the letter p in the searh box the following name is retrieved Nikos Pistolou...which makes sense as there is such name in the DB....upon pressing p an ajax call is made. And here is my problem When the user presses shift+p (that capital p) 2 ajax calls are made and as a result the above name appears twice.......an unwanted behaviour. What can be causing this and how to fix it? I am attaching an image snapshot. ..
  18. jimfog

    code cleanup

    Where can I upload the code? No I am not usingg MVC
  19. jimfog

    code cleanup

    You are asking me to create a fully functional PHP page...where I can do that? I am just asking
  20. jimfog

    code cleanup

    if((isset(get[package]))or(isset[submitbuzusersolo])or(isset[submitbuuser[multi]])) { if(isset(get[package]))AND(get[pakage])==solo)AND(isset[submitbuzusersolo]) { //display package/payment image if(isset[submitbuzusersolo]) {//make vaidation checks} //display form } if(isset(get[package]))AND(get[pakage])==multi)AND(isset[submitbuzusermulti]) { //display package/payment image if(isset[submitbuzusermulti]) {//make vaidation checks} //display form } } else { //display pakage/payment images } Take a look at the above pseudo code. It achieves the following: When the user comes first to this page it sees 2 images related to the packages offered(it is a SAAS site). When the user clicks the image package that interests him the image package stays in the viewport and below it a registration form appears When the user clicks the submit button the image stays in the viewport-in case the form has errors or if errors are not found redirection will take place....in logged in page. Question: Can the above happen with a cleaner code? Before ending up in this code I have tried other versions and the problem was that -for example-when the user submitted the form(and in the case of errors) the image was gone from the viewport. Another similar problem was that when the user cicked the package image no form was displayed...all these issues due to bad code orgganisatio. But to achieve what I wanted I had to resort to the above complex code...so can it be done cleaner
  21. I want your opinion on a very confusing matter(at least for me)....I use Netbeans as an editor. Netbeans has a history feature...code changes are tracked...somehow,it is very basic/simple-it does not offer of course the features of Git. Aparth from that..it does it's job though very good. While coding I find my self many times in the dilemma in using git or Netbeans as atracking tool...sometimes I create git commits,,,,sometimes I use the history feature of Netbeans. This situation is not the optimal of course for coding... So,I want your opinion on the natter...if you had to choose between the two,what it would be- unless there is a "thrid" way for which I am waiting for you to suggest. thx
  22. jimfog

    hard refresh

    and how the above differs from emptying the cache? This is what confuses me.
  23. jimfog

    hard refresh

    Why sometimes soft refresh is not enough to refresh the content of a page and a hard refresh is needed instead? Thanks.
×
×
  • Create New...