473,748 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to put selected Checkbox results out to a .txt file

1 New Member
Hello - i am wondering if anyone can help, I am fairly new to javascript / html and am having difficulty getting selected options ticked using check boxes out to a .txt file and have another script called once the output is placed in to the .txt file. What i am attempting to do is have the user select the options for switches they wish to perform backups on and click submit - have this written out to a .txt file which i will then need to use as part of a parameter when i call a script to run the backup. I also need to know how to call the script ( called /tmp/backupscript.sh ) and execute one the user has selected the options.

Below is the code i have at present

<html>
<head>
<title>New Code with Checkboxes</title>
<script type="text/javascript">
<!--
function listValuesCheck Box(checkBoxRef )
{
var list = [];
for (var i=0, len=checkBoxRef .length; i<len; i++)
{
if (checkBoxRef[i].checked)
{
list.push(check BoxRef[i].value);
}
}
alert(list.join ('\n'));
}

function openFile () {
var strTemp;
var fso = new ActiveXObject(" Scripting.FileS ystemObject")
var textStream = fso.OpenTextFil e("/tmp/test.txt");
while(!(textStr eam.AtEndOfStre am))
{
strTemp = textStream.Read Line()
document.writel n(strTemp)
}
}
//-->
</script>
</head>
<body>
SELECT SWITCH ADDRESS TO PERFORM BACKUP ON :
<form name="input" action="html_fo rm_action.asp" method="get">
<label for="10.13.250. 83"><input type="checkbox" id="10.13.250.8 3" name="cbSet1" value="10.13.25 0.83">10.13.250 .83</label><b
r>
<label for="10.13.250. 66"><input type="checkbox" id="10.13.250.6 6" name="cbSet1" value="10.13.25 0.66">10.13.250 .66</label><b
r>
<label for="10.1.1.1"> <input type="checkbox" id="10.1.1.1" name="cbSet1" value="10.1.1.1 ">10.1.1.1</label><br>
<label for="10.2.2.2"> <input type="checkbox" id="10.2.2.2" name="cbSet1" value="10.2.2.2 ">10.2.2.2</label><br>
<label for="10.3.3.4"> <input type="checkbox" id="10.3.3.4" name="cbSet1" value="10.3.3.4 ">10.3.3.4</label><br>
<label for="10.1.2.2"> <input type="checkbox" id="10.1.2.2" name="cbSet1" value="10.1.2.2 ">10.1.2.2</label><br>
<input type="button" value="Show checked" onclick="listVa luesCheckBox(th is.form.cbSet1) ;">
<input type="button" value="Show checked" onclick="listVa luesCheckBox(th is.form.cbSet1) ;">
<input type="button" value="Open File" onclick="openFi le();">
<input type="reset">
</form>
</body>
</html>

Any help someone could offer would be greatly appreciated
Thanks
Mar 22 '07 #1
1 2655
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN.

Just a suggestion: why not just do this on the server-side? Then you don't have to worry about activex objects and it only working in IE.

For writing to a text file, see this MSDN link.
Mar 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3127
by: Greg Hurlman | last post by:
I've got a very simple ASCX page, where once someone finishes a section and clicks the "Next >" button, the section they just finished is disabled, and the next section appears below it, and so on. One of the controls is a checkbox, which, when clicked, displays a hidden panel containing controls whose input are used for filtering query results. If someone checks the checkbox in the first section and clicks the first "Next >" button,...
5
3369
by: tshad | last post by:
Is there a way to allow a user to press a radio button if it is already selected? There is an onCheckedChanged event that fires when the person presses the button and it is isn't selected already. If it is selected, it doesn't fire. This isn't the case with a checkbox. The event fires whether the control is already checked or not. Thanks,
4
4001
by: juststarter | last post by:
Hello, I have an aspx file where i've put a placeholder element. On load (page_load) i create dynamically an html table which contains a checkbox and a radiobuttonlist in each tablerow . The radiobuttonlist contains two items (yes,no). Both the checkboxes and the radiobuttonlist are NOT autopostbacked ( .autopostback = false). When i press the submit button a sub (submit_pressed) is run. My problem is that i can not get the selected items...
4
2392
by: M | last post by:
Hello, I would like to get a value for a non selected checkbox in a form. Imagine my form contains : <input type='checkbox' name='t' value='1'> <input type='checkbox' name='t' value='1'> When I analyse $t, if first checkbox is not selected and second is, I have :
10
3758
by: aniltc | last post by:
I have a list of users(signed for a newsletter).I'm retrieving the list from a database when the admin clicks on a button. There are maximum 10 users diplayed per page.For example,if I had 30 users in the database,I would have 3 pages of users(Page 1,2,3); For each listed user ,I have a checkbox on the right side.The checkbox is for when the admin wants to selected a few people to whom send the newsletter. Ex: Page: 1|2|3 1.ana checkbox...
0
2243
by: pankajprakash | last post by:
Hi, I have a treeview control which have checkbox control. I just need to fetch the selected checkbox value (id of selected node of tree view). I have used following code to get the no. of selected checkbox of tree view control.... function UnCheckAllCheckBoxes() { //debugger
37
4550
by: viki1967 | last post by:
Hi all. I have this simple form. I need if checkbox C_1 is selected: 1) field name="n_1" is required and accept only numbers; 2) field name="n_2" is required and accept only numbers; I need if checkbox C_2 is selected:
8
6229
by: ALTAFAD | last post by:
How to copy selected (s) textfield, which those selected through checkbox I like to copy in clipboard. Access textfield data when front of the textfield checkbox is checked if not checked it should not copy in clipboard. If text field has data like that altaf/ahmed mr one field checked goodguydude@thisandthatandtheother.com one field checked...
21
11135
by: mukeshrasm | last post by:
Hi I am deleting records from database using checkbox. means only that record will be deleted from database which are selected in checkbox. and before deleting record I am displaying a message "Are you sure to delete the selected records" using javascript.and when user clicks OK, record is deleted. Here in message I want it should like "Are you sure to delete 5 records" if user selects 5 records. So how can I do this using javascript. ...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.