Search Results

Search found 6 results on 1 pages for 'solefald'.

Page 1/1 | 1 

  • jQuery / jEditable and jQuery UI Dialog. Re-populating table cell.

    - by solefald
    Hello, this is my first time using JS, so i really have no idea what i am doing. I have a table with data, and using jEditable to allow a user to edit the data and POST it to my php script. When user hits "Save", it opens jQuery UI with the data from php script and it seems to work fine, however, if the user hits Cancel or Esc to close the jQuery UI dialog, they and up back on the page, but the cell they tried to edit is now completely empty. How do i get the cell re-populated? Thank you! $(".editable_textarea").editable("/path/to/my/scrip.php", { indicator : "<img src='/images/indicator.gif'>", type : 'textarea', submitdata: { _method: "post", uri: "<?php echo $this->uri->segment(3); ?>" }, select : false, submit : 'Save', cancel : 'Cancel', tooltip : "Click to edit...", cssclass : "editable", onblur: "cancel", cssclass: "edit_destination", callback: function(value, settings) { $(this).dialog({ autoOpen: true, width: 400, modal: true, position: "center", resizable: false, draggable: false, title: "Pending Changes", buttons: { "Cancel": function() { $(this).dialog("close"); }, "Confirm Changes": function() { document.findSameDestination.submit(); } } }); $('form#findSameDestination').submit(function(){ $(this).dialog('open'); return false; }); $(this).editable("disable"); }, data: function(value, settings) { var retval = value.replace(/<br[\s\/]?>/gi, '\n'); retval = retval.replace(/(<([^>]+)>)/gi, ''); return retval; } });

    Read the article

  • Empty POST from jQuery UI Dialog to PHP function with $.post

    - by solefald
    Hello, I am having hell of a time trying to figure this one out. Maybe someone can help me here or point me in the right direction. I have a jQuery UI dialog that pops up when user clicks on an image. The dialog displays a form with 2 drop down windows. "dept" and "group". Group drop down is disabled, until something is selected in the "dept" dropdown menu. When user selects a department, I do a POST to php function and then enable and populate the group drop down. Simple enough... <select name="dept" id="dept_select" onchange="getDeptGroups(this.value);"> // Some data here </select> JS function: function getDeptGroups(dept) { // This alert works and displays department name. //alert(dept); $.post("/am/ldap/getDepartmentGroups.php", { department: dept }, function(data){ alert(data); }); } and finally in php page i just do <? print_r($_POST); ?> and end up with empty array. Array ( ) This happens in both, Chrome and Firefox, however, FireBug clearly shows post data being submitted: What am i doing wrong here?

    Read the article

  • Can't empty JS array....

    - by solefald
    Yes, I am having issues with this very basic (or so it seems) thing. I am pretty new to JS and still trying to get my head around it, but I am pretty familiar with PHP and have never experienced anything like this. I just can not empty this damn array, and stuff keeps getting added to the end every time i run this. I have no idea why, and i am starting to think that it is somehow related to the way chekbox id's are named, but i may be mistaking.... id="alias[1321-213]", id="alias[1128-397]", id="alias[77-5467]" and so on. I have tried sticking checkboxes = []; and checkboxes.length = 0; In every place possible. Right after the beginning of the function, at the end of the function, even outside, right before the function, but it does not help, and the only way to empty this array is to reload the page. Please tell me what I am doing wrong, or at least point me to a place where i can RTFM. I am completely out of ideas here. function() { var checkboxes = new Array(); checkboxes = $(':input[name="checkbox"]'); $.each(checkboxes, function(key, value) { console.log(value.id); alert(value.id); } ); checkboxes.length = 0; } I have also read Mastering Javascript Arrays 3 times to make sure I am not doing something wrong, but still can't figure it out....

    Read the article

  • jQuery.post() issues with passing data to jQuery UI

    - by solefald
    Hello, I am trying to get jQuery.post() to run my php script and then open a jQuery UI dialog with the data that php script returns. Its supposed to come back as a form with a table and a textarea in it. It works great with alert(data); and i get a pop-up with all my data. The problem starts if i turn off alert(). Now it opens 2 dialogs. One containing only the table, without textarea, and the second one absolutely empty. What am i doing wrong here? How come all my data shows up in the alert(), but not in dialog? What do i need to do to fix it? Oh, and do i need to also include $.ajax() before the $.post()? Thank you. $.post("/path/to/script.php", { id: this.id, value: value }, function(data){ // THIS WORKS //alert(data); // THIS DOES NOT WORK $(data).dialog({ autoOpen: true, width: 400, modal: true, position: 'center', resizable: false, draggable: true, title: 'Pending Changes' }); } );

    Read the article

  • PHP in_array() can't even match a single character. Strict is set to true.

    - by solefald
    I've seen a million of these threads here already, and read through every single one already. Including some serious time Googling. Nothing complicated. All I have to do is check if a single character in a loop matches my alphabet array. print_r($alphabet); // all 26 letters Array ( [0] => a [1] => b [2] => c ... [23] => x [24] => y [25] => z ) print_r($emptyLetters); // dynamic array. Array ( [0] => b [1] => s ) foreach($alphabet as $letter): { echo $letter . '<br />' // Correctly prints out every letter from $alphabet. if(in_array($letter, $emptyLetters, true)): // $strict is set // do something endif; } What the hell is going on??? I do not understand what i am doing wrong.... I tried every combination and option possible, but for some reason even array_search() is bit working...

    Read the article

  • CodeIgniter Form Validaton + JS. Form re-population.

    - by solefald
    Hello. I have a from with a checkbox, and depending on the checkbox state 2 different divs are shown. var alias = document.getElementById('alias'); var list = document.getElementById('list'); if(document.getElementById('isList').checked) { alias.style.display = 'none'; list.style.display = 'table-row'; } else { alias.style.display = 'table-row'; list.style.display = 'none'; } Here is the HTML/PHP (relevant) part: <tr id="alias" style="display:table-row;"> <td>' . form_label('Destination:', 'destination') . '</td> <td>' . form_textarea('destination') . '</td> </tr> <tr id="list" style="display:none;"> <td>' . form_label('File Path:', 'list_path') . '</td> <td>' . form_input('list_path') . '</td> </tr> alias div is shown by default on page load, list shown then i click on isList checkbox, and alias is shown again when i click on the checkbox again. This part works great and pretty straight froward. Now, I add CodeIgniter Form Validation plugin, set appropriate rules and set-up validation plugin to re-populate the form with. Without checkbox enabled everything works great. On errors form is re-populated. However, when form is submitted with checkbox enabled, I have an issue. CI's Form Validation plugin re-populates the form, and re-enables the checkbox, but the list div that is supposed to be shown when checkbox enabled is not there, and instead the alias div is shown. Is there any way around this issue? Can i have the list div shown on list validation error? Also, i would like to avoid using JavaScript form validation, and stick with my good old PHP. Thank you in advance. -i

    Read the article

1