Jump to content

ainoy31

Members
  • Posts

    370
  • Joined

  • Last visited

    Never

Everything posted by ainoy31

  1. Thanks man. Working as I needed it to.
  2. Hello- I have two drop down menu and when the user clicks save, I have a confirmation box that pops up to confirm their selection. Here is my code for the menu: Product: <select name="secondary_rating_product" class="smaller" id="product"> <? for($x = 0; $x < $numCount; $x++) { ?> <option value="<?=$data[$x]->productItemId ?>"><?=$data[$x]->name?></option> </select> Priority Level: <select name="priority_level" class="smaller" id="level"> <? for($x = 1; $x <= $y; $x++) { ?> <option value="<?=$x?>"><?=$x?></option> <?}?> </select> Here is the javascript for the confirmation box. function confirmSelect() { var prod = document.getElementById('product').value; var lvl = document.getElementById('level').value; return confirm("Please confirm your selection.\n" + "Secondary Rating Product: " + prod + "\n" + "Priority Level: " + lvl); } Everything is working fine except one thing. In the confirmation box with the Secondary Rating Product, it displays the numerical ID of the product but I need it to display the name of it. I know that if I change the <option value="<?=$data->productItemId?>"><?=$data->name?></option> to <option value="<?=$data->name?>"><?=$data->name?></option> it will work. However, I need the product ID since I am using that to insert into the DB. Is this possible to do with what I have currently? Hope this is clear enough. Thanks. AM
  3. Resolved. I added a check tag to see if the phone service is turn on or off and validate base on that value.
  4. Hello- I am having an issue with my javascript validation on my form. Here is the process of my form. On the main form, I have a button with the user can select to add a rating attribute so they can add a phone service. Once that is completed, they are redirected back to the main page that now has a drop down menu to select a phone service. If they try to save and don't select a phone service, the javascript alerts an error message that they need to select one. The user are allow to go back to the rating attribute page and uncheck the rating attribute. This will remove the added phone service and redirect the user back to the main form. To complete the process, they need to click on save. This is my issue with the javascript. It does not save and returns an error message of: Error: 'document.edit_product.primary_rating_product.value' is null or not an object. How can I avoid it from checking to see is a phone service has been selected if even there is no phone service to choose from? Thank you. Here is my javascript code: function validateProductForm() { if(document.edit_product.primary_rating_product.value == 0) { errmsg += 'You must select a Primary Rating Product\n'; } if( errmsg != '' ) { alert( errmsg ); } else { window.document.edit_product.submit(); } function alertuser(field,msg) { alert(msg); field.focus(); } } The drop down menu: <select name="primary_rating_product" class="smaller"> <option value="<?=$data->productItemId?>"><?=$data->name?></option> </select> Hope this makes sense. Much appreciation.
  5. Yeah. I did not realize that I was turning it into a string rather an array. Here is my solution: function getPos() { var locArray = new Array(); var elementToFind = document.getElementById('cancelTrigger'); var elementLocs = findPos(elementToFind); return elementLocs; } Then in the Calendar.setup(), I did this: Calendar.setup({ inputField : "futureCancelDate", // id of the input field ifFormat : "<?= str_replace(array('Y', 'y', 'm', 'd'), array('%Y', '%y', '%m', '%d'), $locale->getDateFormat()) ?>", button : "cancelTrigger", // trigger for the calendar (button ID) singleClick : true, position : getPos() //get the [x,y] locations for the img tag so the popup calendar will display properly in IE }); Later.
  6. Sorry. Forgot to finish my last sentence. If I keep it as position : document.getElementById('location').value, the popup calendar does not display properly.
  7. Hello- I am using the DHTML calendar widget for my popup calendar. Since IE is not displaying the popup calendar properly on the page, I had to calculate the (x,y) locations of my image tag. This will tell IE the exact location for the popup calendar. Here is the javascript to determine (x,y) locations. This is working. <script language="JavaScript" type="text/javascript"> <!-- function getPos() { var elementToFind = document.getElementById('cancelTrigger'); var elementLocs = findPos(elementToFind); var result = document.getElementById('location').value = ('[' + elementLocs + ']'); } function findPos(obj) { var curleft = curtop = 0; if(obj.offsetParent) { curleft = obj.offsetLeft; curtop = obj.offsetTop; while(obj = obj.offsetParent) { curleft += obj.offsetLeft; curtop += obj.offsetTop; } } return [curleft, curtop]; } window.onload = getPos; //--> </script> Here is the form code that initiates the popup calendar. <tr> <td colspan="*" valign="bottom"> <input type="text" name="future_cancel_date" value="" id="futureCancelDate" readonly="1"> <img src="/images-system/ico_date.gif" border="0" id="cancelTrigger" style="cursor: pointer;" title="Date selector"> <a href="#" onclick="javascript:document.cancelform.future_cancel_date.value=''"><?= $langContent[$section]['clear_cancellation_date'] ?></a> <input type="hidden" id="location"> </td> </tr> Here is the javascript for the DHTML calendar setup. <script type="text/javascript"> <!-- Calendar.setup({ inputField : "futureCancelDate", // id of the input field ifFormat : "<?= str_replace(array('Y', 'y', 'm', 'd'), array('%Y', '%y', '%m', '%d'), $locale->getDateFormat()) ?>", button : "cancelTrigger", // trigger for the calendar (button ID) singleClick : true, position : document.getElementById('location').value }); //--> </script> The hidden input field with ID of location contains the (x, y) locations. So, for my current page it returns the locations of [152, 722]. My problem it in the position property of the calendar.setup(). If I hard code the return locations as position : [152,722] the popup calendar displays where it needs to be. If I keep it the as position : document.getElementById('location').value Hope I explained it thorough enough and easy to follow. Much appreciation.
  8. No. passing it elementLocs does not work. i get the error message that there is nothing to setup. have you use this DHTML calendar widget before?
  9. lemmin- ok, if i do alert(elementLocs) in the getPos() function i get my coordinates in an array of [152, 722], which is good. Either i have been coding too long or something, i still am having an issue passing this array into the Calendar.setup() function for the position option.
  10. Hello- I need help with my script to find the (x,y) coordinates of an element tag on a page. Here is my javascript: function getPos() { var elementToFind = document.getElementById('cancelTrigger'); var elementLocs = findPos(elementToFind); alert(elementLocs[0] + ' ' + elementLocs[1]); } function findPos(obj) { var curleft = curtop = 0; if(obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while(obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft, curtop]; } Here's where I am calling this: <tr> <td colspan="*" valign="bottom"> <input type="text" name="future_cancel_date" value="" id="futureCancelDate" readonly="1"> <img src="/images-system/ico_date.gif" border="0" id="cancelTrigger" style="cursor: pointer;" title="Date selector" onClick="getPos();"> <a href="#" onclick="javascript:document.cancelform.future_cancel_date.value=''"><?= $langContent[$section]['clear_cancellation_date'] ?></a> </td> </tr> I am able to get the x and y locations such as 152, 722. My issue is to pass these values in the position option of the Calendar.setup() javascript function as below: <script type="text/javascript"> Calendar.setup({ inputField : "futureCancelDate", // id of the input field ifFormat : "<?= str_replace(array('Y', 'y', 'm', 'd'), array('%Y', '%y', '%m', '%d'), $locale->getDateFormat()) ?>", // format of the input field button : "cancelTrigger", // trigger for the calendar (button ID) singleClick : true, position : [x, y] //x=152 and y=722 }); </script> The reason why I need to figure the x,y is because IE is not positioning the popup calendar properly by using the align option. the popup calendar displays somewhere else but it needs to be next to my calendar icon. I hope this is easy to follow and understand. Much appreciation. AM
  11. Hello- I am having an issue with validating my form. Here is my form input fields: <form name="usage" action="usage_detail.php" method="post" target="_blank"> <input type="text" class="DW100" id="f_date_c" name="start_date" readonly="1" / value="" /> <input type="text" class="DW100" name="end_date" id="f_date_c2" readonly="1" / value=""> <div class="ButtonContainer Inline"> <a class="Button Small" href="#" id="FormSubmit" onClick="validateDates(this.form);"><span>View</span></a></div> </form> Here is the javascript that I am using but it does not validate and continues to the next page. <script language="javascript" type="text/javascript"> <!-- function validateDates() { if(document.usage.start_date.value == '' || document.usage.end_date.value == '') { ok = false; } else { ok = true; } if(ok = true) { document.usage.submit(); } else { alert("The start and the end dates need to be entered."); } } //--> </script> Much appreciation. AM
  12. Hello- I need help with validating my inputs on a form. Is here my submit code. I highlighted the two input names and the submit action. <ul> <li><?=$langContent[$section]['custom_range'];?>: <?=$langContent[$section]['from'];?> <input type="text" class="DW100" id="f_date_c" [b]name="start_date"[/b] readonly="1" / value="" /><img src="/includes/calendar/ico_calendar.gif" align="top" width="30" height="22" id="f_trigger_c" style="cursor: pointer;" title="Date selector" onmouseover="this.style.background='white';" onmouseout="this.style.background=''" /> <?=$langContent[$section]['to'];?> <input type="text" class="DW100" [b]name="end_date"[/b] id="f_date_c2" readonly="1" / value=""><img src="/includes/calendar/ico_calendar.gif" align="top" width="30" height="22" id="f_trigger_c2" style="cursor: pointer;" title="Date selector" onmouseover="this.style.background='white';" onmouseout="this.style.background=''" /> [b]<div class="ButtonContainer Inline"> <a class="Button Small" href="#" id="FormSubmit" onClick="validateDates(this.form);">[/b]<span><?=$langContent[$section]['view'];?></span></a></div><input type="hidden" name="ckey" value="<?=$customerID;?>"><input type="hidden" name="skey" value="<?=$accountID;?>" /></li> </ul> Here is my javascript for validation. <script language="javascript" type="text/javascript"> <!-- function validateDates(form) { ok = false; if(!document.usage.start_date.value.length == '') { ok = true; } if(!document.usage.end_date.value.length == '') { ok = true; } if(ok = true) { document.usage.submit(); } else { alert("The start and the end dates need to be entered."); } } //--> </script> Thanks for the help. Ainoy
  13. Ok. seems like this is working. $billDay = $objCustomer->getCustomerBillDay(); //for this example, the $billDay = 10 but it is dynamic not static for($x = 3; $x > 0; $x--) { $previousThreeBillCycle = mktime(0, 0, 0, date("m") - $x, $billDay, date("Y")); echo $startBillCycle = date("Y-m-d", $previousThreeBillCycle); list($year, $month, $day) = explode('-', $startBillCycle); echo "<br>"; echo $daysInMonth = date("t", mktime(0,0,0, $month, 1, $year)); echo "<br>"; $endBillCycle = strtotime("+1 month", $previousThreeBillCycle); echo date("Y-m-d", $endBillCycle); echo "<br>"; echo "<br>"; } the result is: 2008-05-10 31 2008-06-10 2008-06-10 30 2008-07-10 2008-07-10 31 2008-08-10 My question is why is the endBillCycle is not calculating right? For example, the start date is 2008-05-10 and the end date should be 2008-06-09 not 2008-06-10 as above. Thanks. AM
  14. No, the bill start day can be different for each client. Someone can have it start on the 10th of the month. That is why in the code: $previousThreeBillCycle = mktime(0, 0, 0, date("m") - $x, $billDay, date("Y")); $billDay is derived from a call to another method, getBillDay. Also, that is why I am calculating how many days are in each month since the total days are different. $daysInMonth = date("t", mktime(0,0,0, $month, 1, $year));
  15. the end bill cycle should be the start bill cycle plus the days in the month such as if the start bill cycle is 2008-05-01 then the end bill cycle is 2008-06-01.
  16. Hello- I need help with my date function. Basicly I am going back to three previous billing cycles for a client from the current date. I figure out when their bill start date is and then figure out the total days in the month to give me when it starts and ends. My problem is calculating the previous bill cycle end date. Here is my code. for($x = 3; $x > 0; $x--) { $previousThreeBillCycle = mktime(0, 0, 0, date("m") - $x, $billDay, date("Y")); echo $startBillCycle = date("Y-m-d", $previousThreeBillCycle); //this prints 2008-05-01 list($year, $month, $day) = explode('-', $startBillCycle); echo "<br>"; echo $daysInMonth = date("t", mktime(0,0,0, $month, 1, $year)); //31 days in this month echo "<br>"; echo $endBillCycle = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d", $startBillCycle) + $daysInMonth, date("Y"))); //this where I am helping an issue echo "<br>"; } Hope this is not confusing to follow. Much appreciation. AM
  17. Thanks for the help. It works. Much appreciation.
  18. Hello- I am having an issue trying to figure out the beginning of the previous month. I am doing a previous billing cycle feature where I display three previous billing cycle from current date. This is what I am using to go back three months. $previousThreeBillCycle = mktime(0, 0, 0, date("m")-3, date("d"), date("Y")); $previousMonth = date("Y-m-d", $previousThreeBillCycle); That gets me the date of 2008-05-08. I know that the bill start date is on the first of every month and it is a monthly plan. I can't seem to think through the logic for this. Much appreciation. I hope this is clear enough. AM
  19. This is what I would do base on what you are saying. Create a table that has fields to capture the sale reps name and the region they belong to such as: table name is sale_rep ( id //this is for the unique ID that will auto_increment each time you add a new sale reps. this takes care of your question regarding transferring ID to another page name //sale reps name region //name of the region they belong to ) So, you will have a form that will have the two drop down menus and just pass that information they selected to the second page. The second page is where you will do an INSERT statement in the sale_rep table. I hope this is what you are looking for.
  20. Please post your code for review.
  21. wouldn't you need to use an alias for the userid and MID as well?
  22. where is variabels $ime and $prezime coming from?
  23. Seems like you are trying to paginate the pages. I am correct here?
  24. have you just tried using: AND ( "'.$start.'"BETWEEN starttime AND endtime OR "'.$end.'" BETWEEN starttime AND endtime) seems like you are doing redundant comparison.
×
×
  • 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.