I'm trying to figure out the problem here and I can't see why its not working. I've got an edit form that 99% of the time submits fine but for some records it doesn't. This is some of the code on the form:
<?php echo form_open('administration/categories/edit_offer_content_success')?>
<table cellpadding="6" cellspacing="0" class="admin-panel table_style">
<tr>
<th><b>Edit Offer</b><?php echo form_hidden('id',$offer->id)?></th>
</tr>
<tr>
<td>Name:<br /><?php echo form_input(array('name' => 'name', 'value' => $offer->name, 'size' => '100'))?></td>
</tr>
<tr>
<td align="center" valign="middle" height="20"><?php echo form_submit('','Save')?></td>
</tr>
</table>
<?php echo form_close()?>
When you click on the save button it should go to the edit_offer_contents function but on some records, it goes to the index page of the site instead. I remmed out all the code in this function and set it to load a debug page instead hoping to track down where the error was occurring, but on the records that won't save, it still goes to the index page of the site so it looks like its not getting to the function but I can't see why. There is no validation as far as I can see and I'm now banging my head against the wall
function edit_offer_content_success()
{
$this->output->enable_profiler(TRUE);
$this->load->view('admin/debug');
// redirect ('administration/categories/edit_offer/'.$id,'refresh');
}
if anyone has any ideas I'd be very grateful
i suppose you have one of the columns set as unique key in the database and sometimes trying to update the values of those columns to some existing values.
Related
I am using angular-datatables 13.0.1 in my angular application. I displayed a table using the following code in my UI. It was working.
Html:
<table datatable class="datatable table table-striped table-condensed h5" [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" bFilter=false>
<tfoot>
<tr>
<td colspan="8">
<div class="center-cont-block">
<mfBootstrapPaginator [rowsOnPageSet]="[50,100,500]"></mfBootstrapPaginator>
</div>
</td>
</tr>
</tfoot>
</table>
.ts file
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 50
};
dtTrigger: Subject<any> = new Subject<any>();
I used this link http://l-lin.github.io/angular-datatables/#/welcome to learn how to display an angular-datatable.
I haven't changed any of the libraries related to this. Surprisingly when I try to implement the same logic in another screen, nothing works.
Either the table developed before or new table.
Pagination is not displayed or the sorting. It is not applying any of the angular-datatables properties. When I inspect the code, many of the properties are missing few them are:
2. aria-controls
I have built an html table that generates dynamically from a data array. It is intended to make a menu of beers on tap in my bar. The array contains the following data: [tap_number, brewery_image, beer_name, price_for_a_pint, price_for_a_pitcher]. Therefore the array dictates that the table generate with 5 columns and 14 rows (with current data). The image data consists of an html tagged image and similarly the beer_name is tagged <h3></h3>. All the html tagged data is rendering as text. What have I done wrong? btw, using Materialize css for basic table styling. Have tried with bootstrap also - same result. Here's a snippet of the html element that the js generates:
<table class = "tabel">
<thead>
<tr>
...has <td>column name</td> X5
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td><img src='[url of image]' alt=''></td>
<td><h3>[Beer_Name]</h3></td>
<td>$6</td>
<td>$10</td>
</tr>
...a bunch more rows..
</tbody>
</table>
.
So data positions 1 and 2 should be rendering according to html tag but are just appearing on the page as the text of their html. All data from the array is passed as textContent. Should I be using innerHtml? when I do, nothing at all renders. Cannot figure out what amateur mistake I've made or whether Materialize is screwing me... Thanks for any advice...
It was an amateur mistake. was using innerHtml instead of innerHTML....
Basically, in English I want to tell Selenium "look for the content ttc202 in column one, of a multi-row, multicolumn table, then mouseOver on the Edit link"
HTML is as follows:
<tr id="86" class="ui-widget-content jqgrow ui-row-ltr ui-state-highlight" tabindex="0" role="row" aria-selected="true">
<td aria-describedby="jqLst_Short Name" style="text-align:left;" role="gridcell">
ttc202
</td>
<td aria-describedby="jqLst_Long Name" style="text-align:left;" role="gridcell">
Testing Training Company 202
</td>
<td aria-describedby="jqLst_Actions" title="" style="text-align:center;" role="gridcell">
<a class="act avw" title="View this Organisation" href="company/view?lcId=86"></a>
<a class="act aed" title="Edit this Organisation" href="company/edit?lcId=86"></a>
</td>
</tr>
I have tried this:
//td[contains(text(),'ttc202')]/following-sibling::td[contains(a/title(),'Edit this Organisation')]/a
All help appreciated. I assume I am missing something to skip over the first column, but can't imagine what will enable me to do that...
Progress:
I have found the following as an alternative which should get to the correct cell, but I am not able to workout how to target the title in the link code:
//td[normalize-space() ="ttc202"])[1]/following-sibling::td[2]/a[. = 'Edit']
I think this is progress just not sufficient to get me to the finish line!
After much investigation I found the following answer, perhaps this might help others who come across this question:
//tr[contains(td[1], "ttc202")]/td[3]/a[#title='Edit this Organisation']
The trick was realising which cell the information was in (represented by the square brackets).
Could you please help me to solve my problem?
I would like to place a checkbox on every row of a list of users built with database information and add a validation button to post my form. My list should look something like this:-
So the user will select the checkbox linked to the student he wants to validate.
The number of rows of the result is variable, so i don't know how to do it.
I hope i've been clear in my description.
You haven't shown any code, but I am assuming that you get the number of students somewhere in your controller.
To achieve what you want with Zend_Form, you will need to render each element individually, but first you need to find a way of adding the correct number of elements to your form.
Preferably, you would do this in your form class to keep the logic out of the controller, but to keep this answer simple I will show you how to achieve this in your controller, you can then adapt the code as you wish.
$numStudents = getNumberOfStudentsSomehow();
$studentForm = new yourFormClass();
for($i = 0; $i <= $numStudents; $i++){
$checkBoxes[] = new Zend_Form_Element_Checkbox('checkBox_' . $i);
}
$studentForm->addElements($checkBoxes);
$this->view->studentForm = $studentForm;
Your form now has the correct number of check boxes in it and you can pass it to the view.
In the view you have several options for rendering the form, either a view partial as suggested by RockyFord, a view helper (documentation here), create a custom view script for your form, or render directly in your view.
To get you started you can render individual elements from your form in your view like this:-
echo $this->view->studentForm->checkBox_0;
I think this might be a situation were a partialLoop() might be the best solution.
in your controller get your data from the model as usual and assign it the data to the view
$this->view->modelData= $data;
next make a new .phtml file in /views/scripts for this demo we'll call it _demoRow.phtml then code the html and php for one table row (in this case).
<tr>
<td><?php echo $this->name ?></td>
<td><?php echo $this->class ?></td>
<td><?php echo $this->birth_date ?></td>
<td><input type="checkbox" name="id" value="<?php echo $this->id ?> /></td>
</tr>
Then in your normal view just put the static information and render the partial
<form action="/your/action/url" method="post">
<table class="spreadsheet" cellspacing="0">
<tr>
<th>Student Name</th>
<th>Class</th>
<th>Birth Date</th>
<th>Select</th>
</tr>
<?php echo $this->partialLoop('_demoRow.phtml', $this->modelData) ?>
<tr>
<input type="submit" name="submit" value="valider" />
</tr>
</table>
</form>
This should approximate what you're looking.
I've been messing with this for far too long, and managed to get IE8 working, but IE7 has me stumped.
I've got a table, and for each column, I am trying to extract a number of divs. I am only extracting divs which match specific selectors, not all divs in the column.
My original jquery selector was
jQuery('div.a1, div.a3, div.a4, div.a7','table#a'+tableId+' td:nth-child('+columnNum+')').each(function(){
alert(jQuery(this).attr('id'));
});
This worked great in FF, but didn't trigger the .each function at all in IE.
After messing around for a bit, I got to
jQuery('td:nth-child('+columnNum+') > div.a1, td:nth-child('+columnNum+') > div.a3, td:nth-child('+columnNum+') > div.a4,td:nth-child('+columnNum+') > div.a7', table#a+'tableId).each(function(){
alert(jQuery(this.attr('id'));
});
Not so nice, but works in IE8.
I had tried all sorts of combinations using .eq(+'columnNum+') but nothing else was working.
Now I go and test in IE7, and again the .each isn't being triggered.
What is the nicest way (and cross-browser compatible) to work with this sort of .each element?
--------------addition--------------
After further testing and playing around with suggestions from DrJ and bdukes, I've found that the table#'+tableId breaks the function in both IE7&8.
I've gone back to my original code
jQuery('div.a1, div.a3, div.a4, div.a7','table#a'+tableId+' td:nth-child('+columnNum+')').each(function(){
alert(jQuery(this).attr('id'));
});
as that seems to me the most efficient.
If I remove 'table#a'+tableId, i get the correct response in all browsers, except that it is adding up the results from all tables, and I need to be able to get only the results from one table at a time.
I have also tried 'table#a'+tableId+'>td:nth-child('+columnNum+')').each, but that doesn't work either.
The first function i've used works perfectly in firefox.
----------------the html being selected---------------------------
The tables are being created dynamically in javascript so I can't really copy and past it, but here is what the output looks like. It ends up looking kinda like a gantt chart on a table.
<table id="a1">
<tr>
<th colspan="5">
Group Name
</th>
</tr>
<tr class="rowId1" >
<td>
<div class="a1" id="a43" style="margin-left:13px; width:60px" ></div>
</td>
<td>
</td>
<td>
<div class="a3" id="a93" style="margin-left:4px; width: 80px" ></div>
<div class="a2" id="a94" style="margin-left:4px; width: 30px" ></div>
</td>
<td>
<div class="a1" id="a24" style="margin-left: 15px; width: 65px;" ></div>
</td>
<td>
</td>
</tr>
</tr>
<tr class="rowId1" >
<td>
<div class="a7" id="a24" style="margin-left:10px; width:60px" ></div>
</td>
<td>
<div class="a2" id="a15" style="margin-left:14px; width: 22px" ></div>
</td>
<td>
;
<div class="a2" id="a105" style="margin-left: 8px; width: 50px" ></div>
</td>
<td>
</td>
<td>
<div class="a4" id="a102" style="margin-left: 5px; width: 45px;" ></div>
</td>
</tr>
</table>
It turns out this was an issue with IE failing when two different elements have the same ID. Apparently this breaks the .each function.
I had two tables
table.notes#a1 & table.inputs#a1
The .each function should have gone through each table but instead found neither.
jQuery also wouldn't run in ie with
jQuery('div.a1, div.a3, div.a4, div.a7','table.inputs#a'+tableId+' td:nth-child('+columnNum+')').each(function(){
alert(jQuery(this).attr('id'));
});
which it should have done, as I am them pointing directly to a specific table even if the id is not unique.
I'm using id's retrieved from the database for the id, and IE doesn't like id's that start with numbers, so I just added an 'a' to the beginning of the id.
However, it apparently doesn't like that either, so now I'm adding the first letter of the class and then the '1' or whatever the id number is.
This solves the issue.