Jump to content

raymond_feliciano

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

raymond_feliciano's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a site that logs a user in and does a db lookup to see if the user has acknowledged that they have read a file. If they have not they are sent to a page with links to the files which need to be read. Once they read the file and click the acknowledge link the php script adds this file name along with user name to a table named read. What I want to do is stop the user from navigating away from this page if they have not acknowledged that they read the files. How would I use the javascript onunload function and do an ajax request to check if they have read the files that need to be read. I am new to ajax so any help would be appreciated.
  2. I just recently taken over a website. The owner has a system that alerts the user if the have any unread files that need to be read. Here are the steps, 1.The user logs in 2.The scripts does a db lookup to check if they have any unread files if they don't, they are sent to the main index page 3.If they have any unread files then they will be sent to another page with links to the fiels which need to be read and acknowledged. 4.Once they acknowledged they read the file the script adds this file name to the db which tells the system they have read it so they no longer receive the alert. The problem is if the user chooses not to read they can navigate away from the page. What I would like to is stop them from navigating to any other part of the website untill they acknowledged that they have read the file. Can I accomplish this with php and javascript/Ajax and how? Any help would be helpful.
  3. I just wanted to know if anyone can point me in the right direction. I will be creating a program and this program will need to be able to print prescription like labels, is there anything out there that can do this? Is Avery printing a way to go? Any suggestions will be great. Thanks.
  4. Thanks I was working on a solution similar to your but would work the way I need it. Thanks.
  5. I have an array which is created dynamically here is the output Advair=>40mg Advair=>50mg Dulera=>50mcg Flovent=>20mcg Symbicort=>120/4.5 Symbicort=>140/4.5 As you can see it has some repeated data. I want to know if there is a way to consolidate this array so I can display it like this Advair=>40mg, 50mg Dulera=>50mcg Flovent=>20mcg Symbicort=>120/4.5, 140/4.5 I just want to keep all dosages which belong to the same prescription together. I tried using array_unique() and other methods with no luck. any help is welcomed thanks in advanced.
  6. never mind i got it working by using the .live function.
  7. Ok I made some major changes to my code and shortened it a bit and was able to give each of my dynamic elements unique names. I accomplished this by not cloning the ddl, instead append a new ddl with the unique name. Here is my revised code. $(document).ready(function() { var i = i = $('.clonedInput').length; var count = 2; $('#prescriptions'+i).change(function() { alert(i); var value = $(this).val(); var dataString = 'prescription='+value; $.ajax ({ type: 'POST', url: '<?php echo base_url(); ?>index.php/patients/dynamic_ddl', data: dataString, cache: false, success: function(html) { $('#dosage'+i).html(html); } }); }); $(function(){ $('#btnAdd').click(function(){ $('#page_properties').append('<tr id="input'+count+'" class="clonedInput">'+ '<td><label for="prescriptions'+count+'">Prescription</label></td>'+ '<td><select id="prescriptions'+count+'" class="prescriptions" name="prescriptions'+count+'">'+ '<option selected="selected">--Select Prescription--</option>'+ '<?php foreach ($prescriptions_sel as $option):?>'+ '<option value="<?php echo $option['prescription']; ?>"><?php echo $option['prescription'];?></option>'+ '<?php endforeach ?></select></td>'+ '<td>Dosage: <select id="dosage'+count+'" name="dosage'+count+'" class="dosage">'+ '<option selected="selected">--Select Dosage--</option>'+ '</select>'+ 'Add Dosage: <input type="text" name="new_dosage'+count+'" value="" /></td></tr>'); $('#btnDel').removeAttr('disabled'); count++; i++; }); }); $('#btnDel').click(function() { var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have $('#input' + num).remove(); // remove the last element // enable the "add" button $('#btnAdd').removeAttr('disabled'); // if only one element remains, disable the "remove" button if (num-1 == 1) $('#btnDel').attr('disabled','disabled'); count--; i--; }); $('#btnDel').attr('disabled','disabled'); }); The code I need help with is the first function(ajax part of it). What this code does right now is when the page loads I can select from the first ddl from the first set of ddl and it will populate the second ddl in the first set with the correct values. If I click the add button the second function appends the new set of ddl, now if I select an option from the first(newly appended) ddl in the second(newly appended) set of ddl it will not populate the second ddl(newly appended) with any values but, if I choose an option from the original ddl(first set) the the new ddl does get populated. I hope you guys understand what it is that I am trying to explain here it's just that I am fairly new to the technique and language so I am not so great with the techie talk. I just need to know what I have to change/add to my ajax call function in order to target the ddl which is being changed.
  8. I am very new to ajax and just started to learn jquery also so I hope someone can help me out. I have a form with two ddls and a text box. The first ddl has an ajax call which populates the second ddl depending on user input and it works fine. I also have a button which allows users to add more sets of ddls and text box should they need them. The issue is if the form is displaying two sets of ddls and the user chooses from the first ddl in the first set I only want it to populate the second ddl within that set but, instead it populates all the second ddl in every set. Here is my ajax call and my button functions //Ajax call $(document).ready(function() { $(".prescriptions").change(function() { var id=$(this).val(); var dataString = 'prescription='+id; $.ajax ({ type: "POST", url: "<?php echo base_url(); ?>index.php/patients/dynamic_ddl", data: dataString, cache: false, success: function(html){ $(".dosage").html(html); } }); }); //Add ddl button $('#btnAdd').click(function() { var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have var newNum = new Number(num + 1); // the numeric ID of the new input field being added // create the new element via clone(), and manipulate it's ID using newNum value var newElem = $('#input' + num).clone().attr('id', 'input' + newNum); // manipulate the name/id values of the input inside the new element newElem.children(':first').attr('id', 'name' + newNum).attr('name', 'name' + newNum); // insert the new element after the last "duplicatable" input field $('#input' + num).after(newElem); // enable the "remove" button $('#btnDel').removeAttr('disabled'); // business rule: you can only add 5 names if (newNum == 10) $('#btnAdd').attr('disabled','disabled'); }); $('#btnDel').click(function() { var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have $('#input' + num).remove(); // remove the last element // enable the "add" button $('#btnAdd').removeAttr('disabled',''); // if only one element remains, disable the "remove" button if (num-1 == 1) $('#btnDel').attr('disabled','disabled'); }); $('#btnDel').attr('disabled','disabled'); }); And here is my html markup with my php <tr id="input1" class="clonedInput"> <td><label for="prescriptions">Prescriptions Taken</label></td> <td width="5%"> <select class="prescriptions" name="prescriptions"> <option selected="selected">--Select Prescription--</option> <?php foreach ($prescriptions_sel as $option):?> <option value="<?php echo $option['prescription']; ?>"><?php echo $option['prescription'];?></option> <?php endforeach ?> </select> </td> <td> Dosage: <select name="dosage" class="dosage"> <option selected="selected">--Select Dosage--</option> </select> Add Dosage: <input type="text" name="new_dosage" value="" /> </td> </tr> I know the problem is in the naming conventions for the drop down list since they are not change when they are added dynamically they just keep the name of the cloned elements. What do I need to do to get this to work correctly any help is appreciated
  9. I am a mysql newbie and I have a query which joins 4 tables: SELECT ci_patient_info.*, ci_study_history.study, ci_prescription_history.prescription, ci_icd9_history.icd9_code FROM ci_patient_info JOIN ci_study_history ON ci_patient_info.account_num = ci_study_history.account_num JOIN ci_prescription_history ON ci_patient_info.account_num = ci_prescription_history.account_num JOIN ci_icd9_history ON ci_patient_info.account_num = ci_icd9_history.account_num WHERE ci_patient_info.account_num='2' This works as expected as long as all the fields being selected are not empty but, if any of these fields are empty I get an empty result set. I thought I would still display fields that are not empty. Is my query wrong because I don't understand what is going on. Any help is appreciate and thanks in advanced.
  10. I have a quick question. I am trying to create a complex search form which will join nth number of tables. Here is the process for doing the search the way I have it setup so far. The user clicks the advance search link and a jquery popup is displayed. The user will see the first set of checkboxes which he can check and under the first set of checkboxes the user will be able to click a link stating And | Or. If the user clicks the And link a second set of checkboxes will be displayed using jquery containing the same values as the first set of checkboxes. Now if the user checks the first checkbox in the first set and clicks the second checkbox in the second set these values will be used to query the database. I tried using select boxes but when the form is submitted all the values are sent over instead of what the user pick. Is this the best way to do it or should it be done a different way.
  11. I have data coming in from a table which is used to populate a ddl which will be duplicated depeneding on how many options will be in the ddl. Here I loop thru the array and use the count to figure out how many ddl's I need. <td>From</td> <td id="study_select"> <select id="study_select_1" name="studies_1"> <option value="Study 1">Study 1</option> <option value="Study 2">Study 2</option> <option value="Study 3">Study 3</option> <option value="Study 4">Study 4</option> <option value="Study 5">Study 5</option> <option value="Study 6">Study 6</option> </select> <span id="and"> <label id="study_andlab_2" class="zero_display" for="study_select_and_2">And</label> <select id="study_select_and_2" class="zero_display" name="and_studies_2"> And<option value="Study 1">Study 1</option> And<option value="Study 2">Study 2</option> And<option value="Study 3">Study 3</option> And<option value="Study 4">Study 4</option> And<option value="Study 5">Study 5</option> And<option value="Study 6">Study 6</option> </select> </span> <span id="or"> <label id="study_orlab_2" class="zero_display" for="study_select_or_2">Or</label> <select id="study_select_or_2" class="zero_display" name="or_studies_2"> <option value="Study 1">Study 1</option> <option value="Study 2">Study 2</option> <option value="Study 3">Study 3</option> <option value="Study 4">Study 4</option> <option value="Study 5">Study 5</option> <option value="Study 6">Study 6</option> </select> </span> <span id="and"> <label id="study_andlab_3" class="zero_display" for="study_select_and_3">And</label> <select id="study_select_and_3" class="zero_display" name="and_studies_3"> And<option value="Study 1">Study 1</option> And<option value="Study 2">Study 2</option> And<option value="Study 3">Study 3</option> And<option value="Study 4">Study 4</option> And<option value="Study 5">Study 5</option> And<option value="Study 6">Study 6</option> </select> </span> <span id="or"> <label id="study_orlab_3" class="zero_display" for="study_select_or_3">Or</label> <select id="study_select_or_3" class="zero_display" name="or_studies_3"> <option value="Study 1">Study 1</option> <option value="Study 2">Study 2</option> <option value="Study 3">Study 3</option> <option value="Study 4">Study 4</option> <option value="Study 5">Study 5</option> <option value="Study 6">Study 6</option> </select> </span> <span id="and"> <label id="study_andlab_4" class="zero_display" for="study_select_and_4">And</label> <select id="study_select_and_4" class="zero_display" name="and_studies_4"> And<option value="Study 1">Study 1</option> And<option value="Study 2">Study 2</option> And<option value="Study 3">Study 3</option> And<option value="Study 4">Study 4</option> And<option value="Study 5">Study 5</option> And<option value="Study 6">Study 6</option> </select> </span> <span id="or"> <label id="study_orlab_4" class="zero_display" for="study_select_or_4">Or</label> <select id="study_select_or_4" class="zero_display" name="or_studies_4"> <option value="Study 1">Study 1</option> <option value="Study 2">Study 2</option> <option value="Study 3">Study 3</option> <option value="Study 4">Study 4</option> <option value="Study 5">Study 5</option> <option value="Study 6">Study 6</option> </select> </span> <span id="and"> <label id="study_andlab_5" class="zero_display" for="study_select_and_5">And</label> <select id="study_select_and_5" class="zero_display" name="and_studies_5"> And<option value="Study 1">Study 1</option> And<option value="Study 2">Study 2</option> And<option value="Study 3">Study 3</option> And<option value="Study 4">Study 4</option> And<option value="Study 5">Study 5</option> And<option value="Study 6">Study 6</option> </select> </span> <span id="or"> <label id="study_orlab_5" class="zero_display" for="study_select_or_5">Or</label> <select id="study_select_or_5" class="zero_display" name="or_studies_5"> <option value="Study 1">Study 1</option> <option value="Study 2">Study 2</option> <option value="Study 3">Study 3</option> <option value="Study 4">Study 4</option> <option value="Study 5">Study 5</option> <option value="Study 6">Study 6</option> </select> </span> <span id="and"> <label id="study_andlab_6" class="zero_display" for="study_select_and_6">And</label> <select id="study_select_and_6" class="zero_display" name="and_studies_6"> And<option value="Study 1">Study 1</option> And<option value="Study 2">Study 2</option> And<option value="Study 3">Study 3</option> And<option value="Study 4">Study 4</option> And<option value="Study 5">Study 5</option> And<option value="Study 6">Study 6</option> </select> </span> <span id="or"> <label id="study_orlab_6" class="zero_display" for="study_select_or_6">Or</label> <select id="study_select_or_6" class="zero_display" name="or_studies_6"> <option value="Study 1">Study 1</option> <option value="Study 2">Study 2</option> <option value="Study 3">Study 3</option> <option value="Study 4">Study 4</option> <option value="Study 5">Study 5</option> <option value="Study 6">Study 6</option> </select> </span> <a id="chain_study_and">And</a> | <a id="chain_study_or">Or</a> </td> I am using jquery to remove the zero_display class from the first ddl and click functions to check which chain link was clicked so I can remove the class from the next ddl. For example if the user clicks the And link a ddl will appear with the appropriate label next to it. Once the user chains their query and clicks the submit button all the values of all the select options get sent over when I only need the options the user choose. What is the best way to isolate the choosen options. Should I stay with the select options or should I use checkboxes. I tried check boxes but it would be to much to display.
  12. sorry i didnt realize ti left the group by out. It work like a charm thanks dude really I have been working on this for 6 hours.
  13. if your telling me the query should look like this SELECT ci_patient_info .* FROM ci_patient_info LEFT JOIN ci_study_history ON ci_patient_info.account_num = ci_study_history.account_num LEFT JOIN ci_prescription_history ON ci_patient_info.account_num = ci_prescription_history.account_num WHERE ci_study_history.study IN ( 'study 1','study 2' ) AND ci_prescription_history.prescription IN ( 'script 1','script 2','script 3' ) HAVING count(*)=6 This still returns an empty result set
  14. I have created a search form which joins three tables on a where clause which could have nth number of values. Here is my query SELECT ci_patient_info .* FROM ci_patient_info LEFT JOIN ci_study_history ON ci_patient_info.account_num = ci_study_history.account_num LEFT JOIN ci_prescription_history ON ci_patient_info.account_num = ci_prescription_history.account_num WHERE ci_study_history.study IN ( 'study 1','study 2' ) AND ci_prescription_history.prescription IN ( 'script 1','script 2' ) GROUP BY ci_patient_info.account_num HAVING count(*) = 4 At the moment this will work and I will see the two rows I expect to see. If I add another script to the second IN clause I should see the same two rows but instead I get an empty result set. Here is the query for that. SELECT ci_patient_info .* FROM ci_patient_info LEFT JOIN ci_study_history ON ci_patient_info.account_num = ci_study_history.account_num LEFT JOIN ci_prescription_history ON ci_patient_info.account_num = ci_prescription_history.account_num WHERE ci_study_history.study IN ( 'study 1','study 2' ) AND ci_prescription_history.prescription IN ( 'script 1','script 2','script 3' ) HAVING count(*)= 5 Am I writing these queries wrong because I cant seem to get the results if I added anymore values to any of the IN clauses. I even tried this with no luck. SELECT ci_patient_info .* FROM ci_patient_info LEFT JOIN ci_study_history ON ci_patient_info.account_num = ci_study_history.account_num LEFT JOIN ci_prescription_history ON ci_patient_info.account_num = ci_prescription_history.account_num WHERE ci_study_history.study IN ( 'study 1','study 2' ) AND ci_prescription_history.prescription IN ( 'script 1','script 2','script 3' ) HAVING count(ci_study_history.study)= 2 AND count(ci_prescription_history.prescription) = 3 I am fairly new to MySQL so any suggestions are appreciated
×
×
  • 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.