Input fields appended at the end of search field
Input fields appended at the end of search field
I have added some input fields to capture date and treat as regex info for server side processing. However, the values for all input fields gets reset to the value of the search input field. Could I change this behavior? Is there a more optimum way to implement a more advanced search?
Thanks,
Manro
Thanks,
Manro
This discussion has been closed.
Replies
Allan
Firstly, great work. It has served us quite well.
I am passing custom parameters. I have appended a button to the right of the Search field. Clicking on this button launches an advanced search dialog which allows users to enter dates and regular expressions.
The issue I am running into is if I enter anything in the default search field, that value gets set as the value of the button. So if I search for "test", as the results are returned, the word "test" appears on top my advanced search button on the right.
Any ideas?
Manro
Allan
// Add advanced search button next to search field
$('#div_event_logs .dataTables_filter').append('');
$('#advSearch').click(function() {
advancedSearchOpenClose();
});
[/code]
This is what I did to add a button element next to the Search input box.
Now if I search for 'test', the value attribute of the button also gets set to 'test'
[code]
Search:
[/code]
Does that make sense? Unfortunately, I don't have a link to share.
[code]
$('input', n[i]).val( this.value );
[/code]
Line 3991 in the version which is up-to-date on github.
This is setting all 'input' elements to have a value of the input. The answer is simply to add :eq(0) to the selector... I'm wondering if this is the right thing to do though, since you could just as easily have used insertBefore which would break this is a different way... I guess one answer is to add a class... I'll have a think about it!
Allan
[code]
input#advSearch {
float: right;
margin-top: 1px;
color: transparent;
}
[/code]
I am always reluctant to change anything in the jQuery and jQuery.plugin files, since stuff breaks in the event of an upgrade to a newer version.
Anyway, keep up the good work.
Indeed a class and a more specific selector would be great. I have the exact same issue when trying to add two stupid "Submit" and "Reset" buttons :-)
-- Oh, while writing this, I'm just thinking, why not inserting text instead of buttons? This is a good workaround :-)