Keep An Initial Record From Showing in the Form

I want to filter through existing records via text input so that I can populate a form with client’s data. It all works great with the exception of the initial page load. When the page opens the first record shows up in the fields.

The initial page opens and shows the first record’s data…

I can type the data in the input and it will locate the record perfectly…

Here’s my query info…

Usually, I use this to filter though a list of data. However, I would like to use the same principle to look up a record to populate the form.

Any recommendations? Thanks for any assistance.

Only guessing, what happens if you hide the whole form until the text input has a value?

I tried something similar… I hid the client fields until there was an entry in the search field. The only problem that I could think of during that trial was what would happen if the client tried to add a new service request without searching for a client. The first record data would be inserted without it being seen, and the result would lead to the wrong client info would be associated with the new request data.

I guess there are probably a number of ways you could achieve this (i presume you want the fields to be blank when it loads?)

Could you put value in the field instead of the placeholder text, i.e. Type company name, or first name, or last, name

No search would match that so would return no values. You could format it to look the same as the place holder text.

You could set up another query, so that the search input you have uses that to select the client ID and then sets that value to another variable. That variable is then what your main query has as the condition.

So search for name, name is found, sets client value on another variable that then populates all the data in your form. That way it will return no data until a client ID is selected through your search field.

As it stands at the moment, the CONTAINS condition will always return all results if its blank.

That’s just a couple of ideas, easier to work out when it is your own app and data through.

1 Like

Thanks Phillip! I’ve tried all the conditions, i.e., IS NOT NULL, etc. I believe I will have to redesign the client’s database, or at least make a supplemental source to work with.

I had another idea.

What if you simple add another condition in your query, you would need to rearrange the grouping a little bit but it could be done.

The condition would be something like
Clientid = Get.search

Use the toggle condition (just for this condition, not your other ones)
$_GET.search = " " (or maybe = NULL)

Basically the theory would be that when the search field is empty (i.e. when page loads) it would apply the condition of clientID = search field, which will return no values and the query would be empty, therefor not populating any data.

The moment the search file has some value in it, that condition would not apply and only the existing 3 conditions you have now would apply.

Something like this, but i have just mocked this up. I’m confident it would work though:

Maybe I am not fully understanding your problem? Couldn’t you just check the ‘No Auto Load’ option in your server connect?

Screen Shot 2020-08-08 at 3.29.54 PM

See. Lots of solutions. I’d say that would work, then he’d need to trigger to load it while typing in the search filter.

It might be more of a delay than he wants, but sounds like it would work.

1 Like

Agreed. I did try the ‘No Auto Load’ … unfortunately, it failed. I believe the trigger would have done the trick, but …

I decided to spring off a client list with a url link + id button. Then off to the form page with the query in hand to place the client’s id, name, address and email in their proper fields and …
It works.

Thank you very much for all your excellent help!