I have a form on a website, where I need to submit hundreds of records, manually. The form is in POST method.
I tried with the simple: http://.../form?incomingLead__email=MYNAME
. but this didn't work.
How can I manipulate the Form submission action to include the values?
Trying with a single field as follow: this is the First Name attribute from the HTML:
<input id="incomingLead__firstName" name="incomingLead__firstName" class="text" style="" type="text" onkeypress="var _this=this;return onEnterPressed(event, function() {document.controller.setValue('/ctx/incomingLead/@firstName', _this.value, 'incomingLead__firstName');return true;});" onblur="document.controller.setValue('/ctx/incomingLead/@firstName', this.value, 'incomingLead__firstName')">
The form attribute is:
<form method="post" name="page" class="main-navigation" id="page-form">
Submit button:
<button type="button" id="link-link330" onclick="return linklink330();">Submit</button>
Validate JS function:
function toValidate() { var temp = document.getElementById('temp') if (!temp) return document.controller.submit('submit'); document.controller.setValue("/ctx/vars/iCountProducts", temp.options.length); for (var i = 0; i < temp.options.length; i++) document.controller.setValue("/ctx/vars/products/product" + i, temp.options[i].value); return document.controller.submit('submit'); }
I think of having an excel file, and concatenate the links I need, at least I can reduce the time form filling data, into 2 clicks: one in excel to open the webform, and than submit.
Is it possible with the data given?
2 Answers
Answers 1
Form populating is only possible if the system you're trying to upload to provides such feature. Even if it does, it is only one step away from truly manual data entry, so I recommend avoiding it. Hundreds of records would take a long time.
If your data source is an excel file, you can automate the entire upload process. Simply read the excel file, process the relevant rows one by one, send a POST request for each one.
Here is an example implementation in PHP:
//open xlsx file $simple = new SimpleXLSX('power-mosfet.xlsx'); //get rows from the first worksheet $rows = $simple->rows(1); //process specific lines (starts from 0) $fromLine = 2; $toLine = 8; for($i = $fromLine; $i<$toLine; $i++){ //select relevant values $data = [ 'name' => $rows[$i][0], //column 1 'vdss' => $rows[$i][1], //column 2 'rdson' => $rows[$i][2], //column 3 ]; //send the data in a post request $ch = curl_init('http://example.com/form'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); curl_close($ch); }
If PHP isn't in your wheelhouse, just use a programming language that is. The concept is the same.
Answers 2
You could write a browser extension to handle the data import, form fields hydration and eventually the submits ;)
0 comments:
Post a Comment