Search Placeholder and autofill.

QuestionsSearch Placeholder and autofill.
Valentin asked 7 years ago

Hello sir,
I have 2 questions:
1. How can I set the placeholder for search field on a column ?
Declaration of the column with search:
$col = array();
$col["title"] = "Name";
$col["name"] = "name";
$col["fixed"] = false;
$col["width"] = "200px";
$col["editable"] = false;
$col["style"] = "font-size:2em";
$col["search"] = true;
$cols[] = $col;

2. Having this button button with some dynamic value that comes from php variable:

<button onclick='auto_fill_search(this.id)' id='button1' type='button' class='btn gsc-btn-nobg'>" . $dynamicvariable . "</button>

I did come up with this function :

<script type="text/javascript">
function auto_fill_search(clicked_id)
{
if(clicked_id == "button1")
{
document.getElementById('gs_name').value = '<?php echo $dynamicvariable; ?>';
}
}
</script>

But it don't autofill the search input field on column name.
Is there any way to populate search field from a click on a button (or <a href>?

Many thanks !

4 Answers
Valentin answered 7 years ago

There might be a typo on your Faq about (id) and (ids) since the tip don't work also.

Thanks

Valentin answered 7 years ago

The culprit from FAQ:
<script>
function do_onload(id)
{
$("#gs_name").attr("placeholder","Search Name …").
}
</script>

See that point at the end of the $ line ? Put ";"

Abu Ghufran answered 7 years ago

For case2, please view source page and see if this dynamic value is present or not?
Your code seems correct.

If this variable is passed as POST from other page, you need session persistance.
faq: Q) How to load grid based on $_POST data from other page?

Valentin answered 7 years ago

Thanks Abu.
The form has action="" and is on the same php page as the grid. Can't target the placeholder.

Your Answer

19 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?