(Solved Homework): [Javascript] I have an html page that has dropdown selects and inputs as well as a select tree with checked nodes. I'd

[Javascript] I have an html page that has dropdown selects and inputs as well as a select tree with checked nodes. I’d like to take the selected choices from all of the inputs and turn them into a string which I could then run as a shell script. This is the current form I am using. I’d like to take the inputs and arrange them like this ”

datastore-export-json.sh –outputDirectory “directory input” –layers “layer select” –environment “environment select”….etc for all the selects in the page. The goal is a concatenated string such like “datastore-export-json.sh –output Directory”+directoryinput+”–layers”+layersselect” and then run this as a shell script. Please let me know how to collect my selects into this string and then how to run it as a shell script. This code should be in javascript.

<!– Select Basic –>
<div name=”env” class=”form-group”>
<label class=”col-md-4 control-label” for=”Environment”>Environment</label>
<div class=”col-md-4″>
<select id=”env” name=”Environment” class=”form-control” id=”Environment”>
<option value=”Development”>Development</option>
<option value=”Production”>Production</option>
</select>
</div>
</div>

<!– Select Basic –>
<div name=”prod” class=”form-group”>
<label class=”col-md-4 control-label” for=”Region”>Region</label>
<div class=”col-md-4″>
<select id=”region” name=”Region” class=”form-control” id=”Region”>
<option value=”North America”>North America</option>
</select>
</div>
</div>

<!– Select Basic –>
<div name=”dvn” class=”form-group”>
<label class=”col-md-4 control-label” for=”DVN”>DVN</label>
<div class=”col-md-2″>
<select id=”dvn” name=”DVN” class=”form-control” id=”DVN”>
<option value=”1″>1</option>
<option value=”2″>2</option>
<option value=”3″>3</option>
<option value=”4″>4</option>
<option value=”5″>5</option>
</select>
</div>
</div>

<!– Select Basic –>
<div name=”version” class=”form-group”>
<label class=”col-md-4 control-label” for=”Version”>Version</label>
<div class=”col-md-2″>
<select id=”version” name=”Version” class=”form-control” id=”Version”>
<option value=”1″>1</option>
<option value=”2″>2</option>
<option value=”3″>3</option>
<option value=”4″>4</option>
<option value=”5″>5</option>
</select>
</div>
</div>
<div id=”example”>

<div class=”demo-section k-content”>
<label class=”col-md-4 control-label” for=”Catalog Layers”>Catalog Layers</label>
<div>
<div id=”treeview”></div>
</div>
</div>

<script>
$(“#treeview”).kendoTreeView({

checkboxes: {
checkChildren: true
},

check: onCheck,

dataSource: [{
id: 1, text: “All Layers”, expanded: false, spriteCssClass: “rootfolder”, items: [
{
id: 2, text: “ADAS”, expanded: false, spriteCssClass: “folder”, items: [
]

},
{
id: 6, text: “CV”, expanded: false, spriteCssClass: “folder”, items: [
{ id: 7, text: “CoreMap-ComputedValue”, spriteCssClass: “image” }
]
},
{
id: 9, text: “TM”, expanded: false, spriteCssClass: “folder”, items: [
]
}
]
}]
});

// function that gathers IDs of checked nodes
function checkedNodeIds(nodes, checkedNodes) {
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].checked) {
checkedNodes.push(nodes[i].id);
}

if (nodes[i].hasChildren) {
checkedNodeIds(nodes[i].children.view(), checkedNodes);
}
}
}

// show checked node IDs on datasource change
function onCheck() {
var checkedNodes = [],
treeView = $(“#treeview”).data(“kendoTreeView”),
message;

checkedNodeIds(treeView.dataSource.view(), checkedNodes);

if (checkedNodes.length > 0) {
message = “IDs of checked nodes: ” + checkedNodes.join(“,”);
} else {
message = “No nodes checked.”;
}

$(“#result”).html(message);
}
</script>
<style>
#treeview{
-moz-column-count:2; /* Firefox */
-webkit-column-count:2; /* Safari and Chrome */
column-count:2;
color: blue;
background: white;
}
#treeview:checked + span {
border-color: blue;
background-color:blue;
}
}
body{
background: white;
}
</style>

</div>

<div>
<script type=”text/javascript”>
var environmentselect = document.getElementById(“env”);
var env = environmentselect.options[environmentselect.selectedIndex].text;

var regionselect= document.getElementById(“region”);
var region= regionselect.option[regionselect.selectedIndex].text;

var dvnselect= document.getElementById(“dvn”);
var dvn= dvnselect.option[regionselect.selectedIndex].text;

var versionselect= document.getElementById(“version”);
var version= versionselect.option[versionselect.selectedIndex].text;

var catalogselect= document.getElementById(“catalog”);
var catalog= catalogselect.option[catalogselect.selectedIndex].text;

var formatselect= document.getElementById(“format”);
var format= formatselect.option[formatselect.selectedIndex].text;

var hostselect= document.getElementById(“host”);
var host= hostselect.option[hostselect.selectedIndex].text;

var dirselect= document.getElementById(“dir”);
var dir= dirselect.option[dirselect.selectedIndex].text;
</script>

<br>
<br>

<!– Select Basic –>
<div class=”form-group”>
<label class=”col-md-4 control-label” for=”Catalog Name”>Catalog Name</label>
<div class=”col-md-4″>
<select id=”catalog” name=”Catalog Name” class=”form-control” id=”Catalog Name”>
<option value=”Catalog Name”>Catalog Name</option>
</select>
</div>
</div>

<!– Select Basic –>
<div class=”form-group”>
<label class=”col-md-4 control-label” for=”Format”>Format</label>
<div class=”col-md-4″>
<select id=”format” name=”Format” class=”form-control” id=”Format”>
<option value=”JSON”>JSON</option>
</select>
</div>
</div>

</style>

<!– Search input–>
<div class=”form-group”>
<label class=”col-md-4 control-label” for=”searchinput”>Destination Host</label>
<div class=”col-md-4″>
<input id=”host” name=”searchinput” class=”form-control input-md” id=”searchinput” type=”search” placeholder=””>
</div>
</div>

<!– Search input–>
<div class=”form-group”>
<label class=”col-md-4 control-label” for=”searchinput”>Destination Directory</label>
<div class=”col-md-4″>
<input id=”dir” name=”searchinput” class=”form-control input-md” id=”searchinput” type=”search” placeholder=”C:/DEV/NA/1_2_3/NT_CV”>
</div>
</div>

<!– Button –>
<center><div class=”form-group”>
<label class=”col-md-4 control-label” for=”LOAD”></label>
<div class=”col-md-4″>
<button name=”LOAD” class=”btn btn-primary” id=”LOAD”>LOAD</button>
</div>

Expert Answer

 Hey there, lemme tell you one thing you can not run bash scripts via javascript. Javascript is a client language, i.e., it has power over browser and browser only. So what you could actually do is get all the necessary data via javascript, just like you are doing here and then send it to the backend via AJAX or plain XMLHttpRequest or even the new ECMA 6 fetch(its in experimental phase).

That way you send a string to the backend and most of the backend languages have OS command capabilities(They can just run whatever you send as a bash command). In my opinion you need to put in lots and lots of security otherwise its too dangerous. You can’t just give on the control to the client side javascript.

Javascript is for UX and that’s that. If this is a project idea you came up with, all by your self for a student project that’s cool. If you are doing this for real life use?! you don’t have a proper idea of how stuff works and you need to stop this right here. If you got a doubt, send me a comment.

Cheers,

PrimeHero

iWriteHomework
Order NOW for a 10% Discount
Pages (550 words)
Approximate price: -

Why Us?

Top Quality and Well-Researched Papers

All ourbpapers are written from scratch. In fact, Clients who ask for paraphrasing services are highly discouraged. We have writers ready to craft any paper from scratch and deliver quality ahead of time.

Professional and Experienced Academic Writers

Our writers keeps you posted on your papers progress - providing you with paper outline/draft. You are also at liberty to communicate directly with your writer.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time, in many cases quite ahead of time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents