how to migrate data to update form ASP classic - javascript

i have ASP page that contains clickable table with student information and when i click ID for student take me to update form filled with his information
how could i get these information in the update form ?

If the information is not sensitive, you could pass the value of the fields in the URL which then populates the fields in your update form.
If you add the code you are working with, then I'll be happy to give you a specific example.

Related

How to add JavaScript code to Laravel for BackPack?

I'm using Laravel BackPack to expedite my CRUD webapp.
I have a form with a dropdown list of users.
When a user is selected from this list, I want to populate a text box on the same form with the username of the selected user.
I normally use JavaScript to query the table and return the JSON result.
The returned data is used to populate the #username text box.
I am not sure where to add this JavaScript code in BackPack.
Thanks for your suggestions.
I recommend you create a new field type, starting from the select2 field (or whatever you're using now), and add your JS there.

Make edits on dynamically loaded data using jQuery and PHP

I have a dropdown, on its change I need to load the contents related to it on the same page. Which I did using jQuery. Now the question is how do I make edits on this data and store it on my database. If I am wrong in using jQuery for loading my data then what else should I use? I am using PHP as my server side scripting language.
More detail -
Simply taking there a list of details I need to display as per the country you select, which I am displaying currently in a nice grid(textboxes)!
Now the data from this grid should be copied to another textbox on "EDIT" button click from where I edit them and store it in my database. I am not able to make the values copy into a another textbox
You could do this:
Display the data in some form of editable div, textarea, or other element.
Make a hidden field somewhere and when you display the data
Set the row id from your database to the hidden field
On your change event, grab the id from the hidden field along with the edited data.
Using Jquery/ajax, send that data to a php page that will save thee data to your database using the passed in id.
You could do that.
However, if it were me (and if you're not married to your current databse / mySQL etc..), I would use parse.com. The service is free up to a significant amount of usage (which Ive never come close to) and it really simplifies everything. See the below post if you're interested in that approach:
Save and retrieve user input from database with javascript?

Populating the form

I have a little form with php and javascript. It's a simple form with radio buttons and a couple of text boxes. Under the form there's a table , which is showing the values from the DB.
The php is taking the values of the text boxes and radio buttons and creating a special URL, which is the "Forwarder" in the picture below.
Now when I press the "Edit" button in the table, it must populate the current record with the values of text boxes and radio buttons into the form, so I can edit the values, creating another URL and update the record. The problem is, I don't know how to do it. There can be many records in the table. I don't know how to populate the form with the current record values. And I can't create a table in the DB for each of the values either.
Please can anybody give me some advice ? I will be very thankful.
Thanks beforehand.
On edit click you can run a select query based on the ID of the record. I see you are displaying it, so just grab the text of the ID field from the table. And we assume you have already saved the data from the form above...
Just create a page that gathers the information, and input fields to the table. I'm not sure if fields are static or not, but just populate all the fields manually.
Then have form set to GET type and on submit will be sent by url to the handler page where you could have Query String with PHP so for example index.php?title=TITLE&field1=VALUE
then use $_GET['title] and $_GET['field1'] to grab the information, grab them fields and save back to database.

How to display a link from the MySql database in html using jquery or php

I have cascading drop down form with 3 fields and 'Submit' button. Every field responds to each table in MySQL. So, if you choose an option from each drop down field and hit the 'Submit' button, the script returns and display an info of selected options. See an example: http://blueicestudios.com/chained-select-boxes/three-tier/
What I'm trying to do, is when every options are selected and the 'Submit' button is hit the link to the specific page should also displayed with an info of chosen option.
From an example: I selected a White Ford Mustang - For this type of selection I have a link to the page with a car in MySQL. But, I have no clue how to display it on the page. Any idea how to bring it to alive? Thanks
Just put the url in the form action:
$('form').attr('action','hondaCivicRed.php');
Or whatever they chose.
Submit will take them to the url
Edit:
$('document').on('change','#drop_3',function(){
var url = $('drop_1').val()+$('drop_2').val()+$('drop_3').val()+'.php';
$('form').attr('action',url);
});
It is actually quite a long answer to this question and too much code to write but here is the logic.
There are MUCH better ways of doing this (tables with JOINS etc.) but as a basic 'get it going' you just need to do the following (assuming you have worked out how to post the data and get the $_POST data back)
You could then set a table like so:
Manufacturer, Model, Colour, URL
Then just query the database with SELECT URL FROM table WHERE manufacturer=$_POST['manufactuer'] AND.....
(obviously the above is pseudo code but gives you the logic)
header('Location: $url); in your php.
Hope the above gives you an idea
The better way would be to dynamically create the pages from the database (so you dont need to create a new page for each colour, model etc.) but should give you a grounding

simple way of setting up a 2 step form with html/javascript

I have an html form where the user fills in parcel details and then it outputs a price based on various fields. Then what I want is if the user is happy with the price they can fill in a few more fields such as name, contact info etc and then press submit and the form will get processed via php.
I thought of 2 ways of doing this. First is to have one form and when that is submitted it will generate another form asking for more info. But I need a way of passing variables from the first form to the second so that's not very good.
The second idea was to have a trigger in the form so that when a user changes the value in a certain field it will output the price and then show the other contact info fields. But I'm not sure if this approach is good either.
What's the simplest/smartest way to approach this on client side?
I'd go with the second option.
Step 1. Make a server-side processing page, say quote.php
Step 2. Using javascript, monitor changes to your form fields. Once you have a valid entry, send the post data to quote.php, which should reply back with the quote. Populate a div with the price quote.
JQuery Example:
//You'll have to call this function whenever the user input changes
//Call quote service
$.get("/quote.php",
{
//Pass javascript variables as POST/GET variables
zip: txtzip, weight: txtweight, ship_method: txtship_method
},
// Populate price div on this page with the quote response
function(data){
$("#calc-price").html(data);
});
Step 3: If the user likes the price, they fill out the rest of the form and you process it like a regular ol' form.
If the client has all the data required to perform the price calculation then I would suggest a single form with some show/hide functionality as per your second idea. Others may disagree but I only go back to the server when reading or writing. And even less so if there are webservices available.

Categories

Resources