You are viewing limited content. For full access, please sign in.

Question

Question

Is it possible to populate my database using javascript ?

asked on November 20, 2018

Hi!

 

From LFForm and using a javascript, is it possible to populate a database?

And if yes, how?

 

Thanks in advance.

Regards

0 0

Answer

SELECTED ANSWER
replied on November 20, 2018 Show version history

What are you trying to accomplish? It is not possible to insert data into a SQL database with just Javascript and nothing else. Basically, it comes down to client-side vs server-side issue; JavaScript runs on the client, so on its own it has no way to interact directly with the data on your server (for good reason).

If you absolutely need to update/insert data from a form without it being submitted, you could configure a stored procedure that validates/sanitizes the values and performs the update; I've seen people do this to increment counters and I've used it myself to make minor updates, but you want to be extra careful to ensure you're not overexposing your database.

0 0
replied on November 21, 2018

Hi Jason.

It's logical.

The difficulty is about the search tool and the update tool.

Let me explain. I need to create 1 Search's Form with 5 fields.

 

My search logical is focus on only 1 field (Field 1 OR Field 2 OR Field 3 OR Field 4 OR Field 5).

I should can not search using all the fields.

When the Form find something, it should populate the other fields.

 

Here, I used the Field 1 to search. If my Form return 1 or more results, then the form populated the fields 2,3,4 and 5 with the first result.

 

Here, I used the Field 4 to search. If my Form return 1 or more results, then the form populated the fields 1,2,3 and 5 with the first result.

 

 

 

After return, my Form should be a Update Form and no more a Search Form.

 

In the opposite, of it return no result, the form need to be able to add this new recording in the database then we back to the Update Form.

 

 

That's why I thought I'd add the new record in JavaScript. But it looks like my way is not pretty good.

 

Thank you anyway.

Regards

 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.