Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33774 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2017-08-14 16:10 -0700 |
| Last post | 2017-08-16 05:27 -0700 |
| Articles | 19 — 3 participants |
Back to article view | Back to comp.lang.javascript
Input type file jonas.thornvall@gmail.com - 2017-08-14 16:10 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-14 16:42 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 01:35 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 01:50 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 03:07 -0700
Re: Input type file Julio Di Egidio <julio@diegidio.name> - 2017-08-15 03:43 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 03:43 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 04:16 -0700
Re: Input type file JJ <jj4public@vfemail.net> - 2017-08-15 18:49 +0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 07:31 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 07:36 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 07:42 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 07:49 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 08:06 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 08:26 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-15 08:45 -0700
Re: Input type file JJ <jj4public@vfemail.net> - 2017-08-16 09:10 +0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-16 04:06 -0700
Re: Input type file jonas.thornvall@gmail.com - 2017-08-16 05:27 -0700
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-14 16:10 -0700 |
| Subject | Input type file |
| Message-ID | <ede5bfa5-6b50-4764-9fd7-eabbecc9d5b7@googlegroups.com> |
Input type file create a button saying Choose file No file chosen Is it possible that somehow change layout of button and text? I can see it probably not allowed, but i try to make menus, so basicly i would like have a ".button CSS "LOAD"" that open the filemenu dialog and when file selected the id set and also open the file? I already done the button and if i use the choose file it will open the file, but i want to get rid off the "button?" choose file no file chosen. So can i somehow get the file dialog to open without the button chose file? MENU work _____________ | Chose file |No file chosen .......Can i get rid of this ? ______________ LOAD work SAVE work
[toc] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-14 16:42 -0700 |
| Message-ID | <035ee9f5-c834-4a17-8477-0857b5564d1b@googlegroups.com> |
| In reply to | #33774 |
Den tisdag 15 augusti 2017 kl. 01:11:00 UTC+2 skrev jonas.t...@gmail.com:
> Input type file create a button saying Choose file No file chosen
>
> Is it possible that somehow change layout of button and text?
>
> I can see it probably not allowed, but i try to make menus, so basicly i would like have a ".button CSS "LOAD"" that open the filemenu dialog and when file selected the id set and also open the file?
>
> I already done the button and if i use the choose file it will open the file, but i want to get rid off the "button?" choose file no file chosen. So can i somehow get the file dialog to open without the button chose file?
>
> MENU work
> _____________
> | Chose file |No file chosen .......Can i get rid of this ?
> ______________
> LOAD work
> SAVE work
I tried a new approach i found using label,
<label class="custom-file-upload">
<input type="file" id="fileToLoad" onClick="loadFileAsText()/>
</label>
I just fiddling, it will open the filemanager and i guess i get the correct fileid, but of course no file loaded because of course loadFileAsText executed immediately. So it there a way to do this get loadfileastext exectued **after** you chosed file automatically?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 01:35 -0700 |
| Message-ID | <21142f82-06bf-4e8c-9484-a91d5609417c@googlegroups.com> |
| In reply to | #33775 |
Den tisdag 15 augusti 2017 kl. 01:42:25 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 15 augusti 2017 kl. 01:11:00 UTC+2 skrev jonas.t...@gmail.com:
> > Input type file create a button saying Choose file No file chosen
> >
> > Is it possible that somehow change layout of button and text?
> >
> > I can see it probably not allowed, but i try to make menus, so basicly i would like have a ".button CSS "LOAD"" that open the filemenu dialog and when file selected the id set and also open the file?
> >
> > I already done the button and if i use the choose file it will open the file, but i want to get rid off the "button?" choose file no file chosen. So can i somehow get the file dialog to open without the button chose file?
> >
> > MENU work
> > _____________
> > | Chose file |No file chosen .......Can i get rid of this ?
> > ______________
> > LOAD work
> > SAVE work
>
> I tried a new approach i found using label,
>
> <label class="custom-file-upload">
> <input type="file" id="fileToLoad" onClick="loadFileAsText()/>
> </label>
>
> I just fiddling, it will open the filemanager and i guess i get the correct fileid, but of course no file loaded because of course loadFileAsText executed immediately. So it there a way to do this get loadfileastext exectued **after** you chosed file automatically?
I did find something that may actually work but i am not quite sure howto put it together?
input.onchange = function(e) {
..
};
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 01:50 -0700 |
| Message-ID | <9d28dec7-00a3-4741-b257-5d2d21162486@googlegroups.com> |
| In reply to | #33777 |
Den tisdag 15 augusti 2017 kl. 10:36:02 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 15 augusti 2017 kl. 01:42:25 UTC+2 skrev jonas.t...@gmail.com:
> > Den tisdag 15 augusti 2017 kl. 01:11:00 UTC+2 skrev jonas.t...@gmail.com:
> > > Input type file create a button saying Choose file No file chosen
> > >
> > > Is it possible that somehow change layout of button and text?
> > >
> > > I can see it probably not allowed, but i try to make menus, so basicly i would like have a ".button CSS "LOAD"" that open the filemenu dialog and when file selected the id set and also open the file?
> > >
> > > I already done the button and if i use the choose file it will open the file, but i want to get rid off the "button?" choose file no file chosen. So can i somehow get the file dialog to open without the button chose file?
> > >
> > > MENU work
> > > _____________
> > > | Chose file |No file chosen .......Can i get rid of this ?
> > > ______________
> > > LOAD work
> > > SAVE work
> >
> > I tried a new approach i found using label,
> >
> > <label class="custom-file-upload">
> > <input type="file" id="fileToLoad" onClick="loadFileAsText()/>
> > </label>
> >
> > I just fiddling, it will open the filemanager and i guess i get the correct fileid, but of course no file loaded because of course loadFileAsText executed immediately. So it there a way to do this get loadfileastext exectued **after** you chosed file automatically?
>
> I did find something that may actually work but i am not quite sure howto put it together?
>
> input.onchange = function(e) {
> ..
> };
Sometimes i astonish myself i did it.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 03:07 -0700 |
| Message-ID | <563fcb28-6492-44ef-ba07-d3205e7a9e42@googlegroups.com> |
| In reply to | #33778 |
Den tisdag 15 augusti 2017 kl. 10:50:47 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 15 augusti 2017 kl. 10:36:02 UTC+2 skrev jonas.t...@gmail.com:
> > Den tisdag 15 augusti 2017 kl. 01:42:25 UTC+2 skrev jonas.t...@gmail.com:
> > > Den tisdag 15 augusti 2017 kl. 01:11:00 UTC+2 skrev jonas.t...@gmail.com:
> > > > Input type file create a button saying Choose file No file chosen
> > > >
> > > > Is it possible that somehow change layout of button and text?
> > > >
> > > > I can see it probably not allowed, but i try to make menus, so basicly i would like have a ".button CSS "LOAD"" that open the filemenu dialog and when file selected the id set and also open the file?
> > > >
> > > > I already done the button and if i use the choose file it will open the file, but i want to get rid off the "button?" choose file no file chosen. So can i somehow get the file dialog to open without the button chose file?
> > > >
> > > > MENU work
> > > > _____________
> > > > | Chose file |No file chosen .......Can i get rid of this ?
> > > > ______________
> > > > LOAD work
> > > > SAVE work
> > >
> > > I tried a new approach i found using label,
> > >
> > > <label class="custom-file-upload">
> > > <input type="file" id="fileToLoad" onClick="loadFileAsText()/>
> > > </label>
> > >
> > > I just fiddling, it will open the filemanager and i guess i get the correct fileid, but of course no file loaded because of course loadFileAsText executed immediately. So it there a way to do this get loadfileastext exectued **after** you chosed file automatically?
> >
> > I did find something that may actually work but i am not quite sure howto put it together?
> >
> > input.onchange = function(e) {
> > ..
> > };
>
> Sometimes i astonish myself i did it.
Well i also would like to get rid of using the input field when i save, and instead open a savedialog when i push save in menu, and that the dialog call saveTextAsFile() when i push is that possible?
<button onclick="saveTextAsFile()" class="button">Save File</button><input id="inputFileNameToSaveAs"></input><br>
I do have looked around abit and although many claim to do open the filesave dialog not a single do. They simply download and save a filename?
I just need an example of howto open the filesave dialog, is that even possible? I already do have a working save but to be frank an input field in the menu really do not look nice at all. I would prefer do it like the load.
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2017-08-15 03:43 -0700 |
| Message-ID | <27aaeab5-2b6c-4976-9477-2e208c77f276@googlegroups.com> |
| In reply to | #33779 |
On Tuesday, August 15, 2017 at 12:07:56 PM UTC+2, jonas.t...@gmail.com <snipped> > Well i also would like to get rid of using the input field when i save, You can do whatever you like e.g. in that onchange handler. It's event- driven programming... > <button onclick="saveTextAsFile()" class="button">Save File</button><input id="inputFileNameToSaveAs"></input><br> > > I do have looked around abit and although many claim to do open the > filesave dialog not a single do. They simply download and save a filename? That's the standard way to save a file locally to the client: you still have to post the file to the server to begin with (can be an ajax call). Nowadays there is also so called web storage in HTML5, which lets you store data on the client: not uniformly nor very well supported across browsers, but there are some libraries out there that build and abstract (e.g. for a file system api) on what is available, though some serious technical limitations remain, e.g. in most cases persistence of data is not fully guaranteed. > I already do have a working save but to be frank an input field in the > menu really do not look nice at all. I would prefer do it like the load. A list is not a menu: IMO, you should also work on the precision of your technical descriptions... HTH, Julio
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 03:43 -0700 |
| Message-ID | <b900c392-9ca4-4c78-85ba-4a0ca4c585f4@googlegroups.com> |
| In reply to | #33779 |
Den tisdag 15 augusti 2017 kl. 12:07:56 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 15 augusti 2017 kl. 10:50:47 UTC+2 skrev jonas.t...@gmail.com:
> > Den tisdag 15 augusti 2017 kl. 10:36:02 UTC+2 skrev jonas.t...@gmail.com:
> > > Den tisdag 15 augusti 2017 kl. 01:42:25 UTC+2 skrev jonas.t...@gmail.com:
> > > > Den tisdag 15 augusti 2017 kl. 01:11:00 UTC+2 skrev jonas.t...@gmail.com:
> > > > > Input type file create a button saying Choose file No file chosen
> > > > >
> > > > > Is it possible that somehow change layout of button and text?
> > > > >
> > > > > I can see it probably not allowed, but i try to make menus, so basicly i would like have a ".button CSS "LOAD"" that open the filemenu dialog and when file selected the id set and also open the file?
> > > > >
> > > > > I already done the button and if i use the choose file it will open the file, but i want to get rid off the "button?" choose file no file chosen. So can i somehow get the file dialog to open without the button chose file?
> > > > >
> > > > > MENU work
> > > > > _____________
> > > > > | Chose file |No file chosen .......Can i get rid of this ?
> > > > > ______________
> > > > > LOAD work
> > > > > SAVE work
> > > >
> > > > I tried a new approach i found using label,
> > > >
> > > > <label class="custom-file-upload">
> > > > <input type="file" id="fileToLoad" onClick="loadFileAsText()/>
> > > > </label>
> > > >
> > > > I just fiddling, it will open the filemanager and i guess i get the correct fileid, but of course no file loaded because of course loadFileAsText executed immediately. So it there a way to do this get loadfileastext exectued **after** you chosed file automatically?
> > >
> > > I did find something that may actually work but i am not quite sure howto put it together?
> > >
> > > input.onchange = function(e) {
> > > ..
> > > };
> >
> > Sometimes i astonish myself i did it.
>
> Well i also would like to get rid of using the input field when i save, and instead open a savedialog when i push save in menu, and that the dialog call saveTextAsFile() when i push is that possible?
>
> <button onclick="saveTextAsFile()" class="button">Save File</button><input id="inputFileNameToSaveAs"></input><br>
>
> I do have looked around abit and although many claim to do open the filesave dialog not a single do. They simply download and save a filename?
>
> I just need an example of howto open the filesave dialog, is that even possible? I already do have a working save but to be frank an input field in the menu really do not look nice at all. I would prefer do it like the load.
This works but i do not like the input field in menu, if i just knew howto upon a savedialog i am pretty sure i would solve it. But i can't find examples where the savedialogs open, just like a href exec examples. But i wan't windows filedialog to open on click of "text,link, button, whatever" to write or set the id? before i call the save function.
Is that possible?
<html>
<head>
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-Equiv="content-type" content="text/html; charset=UTF-8">
<link REL="StyleSheet" TYPE="text/css" HREF="drop.css">
<script type="text/javascript" src="loadsave.js"></script>
<script type="text/javascript" src="CSS.js"></script>
</head>
<body>
<div class="dropdown">
<table border="1" bgcolor="white" ><tr>
<td>
<button onClick="GD()" class="dropbtn"><B>___File___</button>
</td>
</tr></table>
<div id="DATA" class="dropdown-content">
<table border="1" bgcolor="white" align=center>
<tr><td bgcolor=white>
<label class="custom-file-upload">
<input type="file"/ id="fileToLoad" onchange="loadFileAsText()">
Load File
</label>
<br>
<button onclick="saveTextAsFile()" class="button">Save File</button><input id="inputFileNameToSaveAs"></input><br>
</td>
</tr></table>
</div>
</div>
<br><br>
<textarea id="inputTextToSave" cols="80" rows="25"></textarea><br>
</body>
</html>
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 04:16 -0700 |
| Message-ID | <f878177e-2ee9-4c54-8874-92a7a2baa62e@googlegroups.com> |
| In reply to | #33781 |
Den tisdag 15 augusti 2017 kl. 12:43:29 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 15 augusti 2017 kl. 12:07:56 UTC+2 skrev jonas.t...@gmail.com:
> > Den tisdag 15 augusti 2017 kl. 10:50:47 UTC+2 skrev jonas.t...@gmail.com:
> > > Den tisdag 15 augusti 2017 kl. 10:36:02 UTC+2 skrev jonas.t...@gmail.com:
> > > > Den tisdag 15 augusti 2017 kl. 01:42:25 UTC+2 skrev jonas.t...@gmail.com:
> > > > > Den tisdag 15 augusti 2017 kl. 01:11:00 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > Input type file create a button saying Choose file No file chosen
> > > > > >
> > > > > > Is it possible that somehow change layout of button and text?
> > > > > >
> > > > > > I can see it probably not allowed, but i try to make menus, so basicly i would like have a ".button CSS "LOAD"" that open the filemenu dialog and when file selected the id set and also open the file?
> > > > > >
> > > > > > I already done the button and if i use the choose file it will open the file, but i want to get rid off the "button?" choose file no file chosen. So can i somehow get the file dialog to open without the button chose file?
> > > > > >
> > > > > > MENU work
> > > > > > _____________
> > > > > > | Chose file |No file chosen .......Can i get rid of this ?
> > > > > > ______________
> > > > > > LOAD work
> > > > > > SAVE work
> > > > >
> > > > > I tried a new approach i found using label,
> > > > >
> > > > > <label class="custom-file-upload">
> > > > > <input type="file" id="fileToLoad" onClick="loadFileAsText()/>
> > > > > </label>
> > > > >
> > > > > I just fiddling, it will open the filemanager and i guess i get the correct fileid, but of course no file loaded because of course loadFileAsText executed immediately. So it there a way to do this get loadfileastext exectued **after** you chosed file automatically?
> > > >
> > > > I did find something that may actually work but i am not quite sure howto put it together?
> > > >
> > > > input.onchange = function(e) {
> > > > ..
> > > > };
> > >
> > > Sometimes i astonish myself i did it.
> >
> > Well i also would like to get rid of using the input field when i save, and instead open a savedialog when i push save in menu, and that the dialog call saveTextAsFile() when i push is that possible?
> >
> > <button onclick="saveTextAsFile()" class="button">Save File</button><input id="inputFileNameToSaveAs"></input><br>
> >
> > I do have looked around abit and although many claim to do open the filesave dialog not a single do. They simply download and save a filename?
> >
> > I just need an example of howto open the filesave dialog, is that even possible? I already do have a working save but to be frank an input field in the menu really do not look nice at all. I would prefer do it like the load.
>
> This works but i do not like the input field in menu, if i just knew howto upon a savedialog i am pretty sure i would solve it. But i can't find examples where the savedialogs open, just like a href exec examples. But i wan't windows filedialog to open on click of "text,link, button, whatever" to write or set the id? before i call the save function.
> Is that possible?
>
>
> <html>
> <head>
> <meta http-equiv="Cache-Control" content="no-store" />
> <meta http-Equiv="content-type" content="text/html; charset=UTF-8">
> <link REL="StyleSheet" TYPE="text/css" HREF="drop.css">
> <script type="text/javascript" src="loadsave.js"></script>
> <script type="text/javascript" src="CSS.js"></script>
> </head>
> <body>
>
> <div class="dropdown">
> <table border="1" bgcolor="white" ><tr>
> <td>
> <button onClick="GD()" class="dropbtn"><B>___File___</button>
> </td>
> </tr></table>
> <div id="DATA" class="dropdown-content">
> <table border="1" bgcolor="white" align=center>
> <tr><td bgcolor=white>
> <label class="custom-file-upload">
> <input type="file"/ id="fileToLoad" onchange="loadFileAsText()">
> Load File
> </label>
> <br>
>
> <button onclick="saveTextAsFile()" class="button">Save File</button><input id="inputFileNameToSaveAs"></input><br>
> </td>
> </tr></table>
> </div>
> </div>
>
> <br><br>
> <textarea id="inputTextToSave" cols="80" rows="25"></textarea><br>
>
> </body>
> </html>
Here is the two javascripts and the CSS.
CSS
input[type="file"] {
display: none;
}
.custom-file-upload {
font-size: 10px;
border: 0px solid #ccc;
display: inline-block;
padding: 0px 0px;
cursor: pointer;
}
.button {
background-color: white;
border: none;
color: black;
padding: 0px 0px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 10px;
}
/* Dropdown Button */
.dropbtn {
background-color: white;
color: black;
padding: 0px;
font-size: 10px;
border: none;
cursor: pointer;
}
/* Dropdown button on hover & focus */
.dropbtn:hover, .dropbtn:focus {
background-color: white;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
position: absolute;
display: inline-block;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: relative;
background-color: white;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: white}
/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {display:block;}
JS 1
function saveTextAsFile()
{
var textToSave = document.getElementById("inputTextToSave").value;
var textToSaveAsBlob = new Blob([textToSave], {type:"text/plain"});
var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
var fileNameToSaveAs = document.getElementById("inputFileNameToSaveAs").value;
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
downloadLink.href = textToSaveAsURL;
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
downloadLink.click();
}
function destroyClickedElement(event)
{
document.body.removeChild(event.target);
}
function loadFileAsText()
{
var fileToLoad = document.getElementById("fileToLoad").files[0];
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var textFromFileLoaded = fileLoadedEvent.target.result;
document.getElementById("inputTextToSave").value = textFromFileLoaded;
};
fileReader.readAsText(fileToLoad, "UTF-8");
}
JS 2
function AG() {
document.getElementById("AUTO").classList.toggle("show");
}
function EG() {
document.getElementById("EDIT").classList.toggle("show");
}
function GD() {
document.getElementById("DATA").classList.toggle("show");
}
function DG() {
document.getElementById("DEBUG").classList.toggle("show");
}
function myFunction() {
var x = document.getElementById('menu');
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
// openDropdown.classList.remove('show');
}
}
}
}
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2017-08-15 18:49 +0700 |
| Message-ID | <89xbrk22x8b8.ch7ecwwqh4wr.dlg@40tude.net> |
| In reply to | #33781 |
On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote: > But > i wan't windows filedialog to open on click of "text,link, button, > whatever" to write or set the id? before i call the save function. Is > that possible? Write or set the ID of what? Either way, just do all those things before calling the `click()` method of the link element.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 07:31 -0700 |
| Message-ID | <56ab82a4-5610-4f62-a7cc-6243e4b75bdd@googlegroups.com> |
| In reply to | #33784 |
Den tisdag 15 augusti 2017 kl. 13:49:13 UTC+2 skrev JJ: > On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > But > > i wan't windows filedialog to open on click of "text,link, button, > > whatever" to write or set the id? before i call the save function. Is > > that possible? > > Write or set the ID of what? Either way, just do all those things before > calling the `click()` method of the link element. The id must be the file that is to be saved? I want it set from windows file save dialog. If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 07:36 -0700 |
| Message-ID | <3b064746-986b-47fa-b197-7c048d803faa@googlegroups.com> |
| In reply to | #33785 |
Den tisdag 15 augusti 2017 kl. 16:31:26 UTC+2 skrev jonas.t...@gmail.com: > Den tisdag 15 augusti 2017 kl. 13:49:13 UTC+2 skrev JJ: > > On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > > But > > > i wan't windows filedialog to open on click of "text,link, button, > > > whatever" to write or set the id? before i call the save function. Is > > > that possible? > > > > Write or set the ID of what? Either way, just do all those things before > > calling the `click()` method of the link element. > > The id must be the file that is to be saved? > I want it set from windows file save dialog. > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save. But it seem to be alot harder i can not even get the file save dialog of windows to open? Well i can get a file to save use input ID="filename" but i do not want a textfield in menu i want to use microsoft file dialog to set the ID. If i could do it for open it should be possible for save?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 07:42 -0700 |
| Message-ID | <9ab93a24-6e20-439b-b7d1-6cad75851691@googlegroups.com> |
| In reply to | #33786 |
Den tisdag 15 augusti 2017 kl. 16:36:20 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 15 augusti 2017 kl. 16:31:26 UTC+2 skrev jonas.t...@gmail.com:
> > Den tisdag 15 augusti 2017 kl. 13:49:13 UTC+2 skrev JJ:
> > > On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote:
> > > > But
> > > > i wan't windows filedialog to open on click of "text,link, button,
> > > > whatever" to write or set the id? before i call the save function. Is
> > > > that possible?
> > >
> > > Write or set the ID of what? Either way, just do all those things before
> > > calling the `click()` method of the link element.
> >
> > The id must be the file that is to be saved?
> > I want it set from windows file save dialog.
> > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save.
>
> But it seem to be alot harder i can not even get the file save dialog of windows to open? Well i can get a file to save use input ID="filename" but i do not want a textfield in menu i want to use microsoft file dialog to set the ID.
>
> If i could do it for open it should be possible for save?
Here is how i managed to do it for open file it take the ID="filename" from windows file dialog and then open that file.
<label class="custom-file-upload">
<input type="file"/ id="fileToLoad" onchange="loadFileAsText()">
Load File
</label>
But i just can't figure out a way even to open the filesave dialog, and i really looked hard for examples on the web but they fetch id from HTML/SCRIPT dialog before saving file i want the ID by microsoft save dialog?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 07:49 -0700 |
| Message-ID | <fd0ee95e-0501-40d0-8161-41060c9c288a@googlegroups.com> |
| In reply to | #33787 |
Den tisdag 15 augusti 2017 kl. 16:42:55 UTC+2 skrev jonas.t...@gmail.com: > Den tisdag 15 augusti 2017 kl. 16:36:20 UTC+2 skrev jonas.t...@gmail.com: > > Den tisdag 15 augusti 2017 kl. 16:31:26 UTC+2 skrev jonas.t...@gmail.com: > > > Den tisdag 15 augusti 2017 kl. 13:49:13 UTC+2 skrev JJ: > > > > On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > > > > But > > > > > i wan't windows filedialog to open on click of "text,link, button, > > > > > whatever" to write or set the id? before i call the save function. Is > > > > > that possible? > > > > > > > > Write or set the ID of what? Either way, just do all those things before > > > > calling the `click()` method of the link element. > > > > > > The id must be the file that is to be saved? > > > I want it set from windows file save dialog. > > > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save. > > > > But it seem to be alot harder i can not even get the file save dialog of windows to open? Well i can get a file to save use input ID="filename" but i do not want a textfield in menu i want to use microsoft file dialog to set the ID. > > > > If i could do it for open it should be possible for save? > > Here is how i managed to do it for open file it take the ID="filename" from windows file dialog and then open that file. > > <label class="custom-file-upload"> > <input type="file"/ id="fileToLoad" onchange="loadFileAsText()"> > Load File > </label> > > But i just can't figure out a way even to open the filesave dialog, and i really looked hard for examples on the web but they fetch id from HTML/SCRIPT dialog before saving file i want the ID by microsoft save dialog? Maybe it is confusing for you if you see it as a save of an already open file,that do not need a file dialog just to have the ID set upon open. Think of it as a save as or a new file i want windows save file dialog to open but i don't even find examples of howto do it?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 08:06 -0700 |
| Message-ID | <89e7d118-fc15-4c5b-af8d-740c2ebf1dba@googlegroups.com> |
| In reply to | #33788 |
Den tisdag 15 augusti 2017 kl. 16:49:29 UTC+2 skrev jonas.t...@gmail.com: > Den tisdag 15 augusti 2017 kl. 16:42:55 UTC+2 skrev jonas.t...@gmail.com: > > Den tisdag 15 augusti 2017 kl. 16:36:20 UTC+2 skrev jonas.t...@gmail.com: > > > Den tisdag 15 augusti 2017 kl. 16:31:26 UTC+2 skrev jonas.t...@gmail.com: > > > > Den tisdag 15 augusti 2017 kl. 13:49:13 UTC+2 skrev JJ: > > > > > On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > > > > > But > > > > > > i wan't windows filedialog to open on click of "text,link, button, > > > > > > whatever" to write or set the id? before i call the save function. Is > > > > > > that possible? > > > > > > > > > > Write or set the ID of what? Either way, just do all those things before > > > > > calling the `click()` method of the link element. > > > > > > > > The id must be the file that is to be saved? > > > > I want it set from windows file save dialog. > > > > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save. > > > > > > But it seem to be alot harder i can not even get the file save dialog of windows to open? Well i can get a file to save use input ID="filename" but i do not want a textfield in menu i want to use microsoft file dialog to set the ID. > > > > > > If i could do it for open it should be possible for save? > > > > Here is how i managed to do it for open file it take the ID="filename" from windows file dialog and then open that file. > > > > <label class="custom-file-upload"> > > <input type="file"/ id="fileToLoad" onchange="loadFileAsText()"> > > Load File > > </label> > > > > But i just can't figure out a way even to open the filesave dialog, and i really looked hard for examples on the web but they fetch id from HTML/SCRIPT dialog before saving file i want the ID by microsoft save dialog? > > Maybe it is confusing for you if you see it as a save of an already open file,that do not need a file dialog just to have the ID set upon open. > Think of it as a save as or a new file i want windows save file dialog to open but i don't even find examples of howto do it? Just to be clear i talk about local file system to open savedialog, not serverside. You can try search there just isn't any example of anyone manage to do it?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 08:26 -0700 |
| Message-ID | <e4646533-9339-4267-9ce9-e80bd45fe763@googlegroups.com> |
| In reply to | #33789 |
Den tisdag 15 augusti 2017 kl. 17:06:17 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 15 augusti 2017 kl. 16:49:29 UTC+2 skrev jonas.t...@gmail.com:
> > Den tisdag 15 augusti 2017 kl. 16:42:55 UTC+2 skrev jonas.t...@gmail.com:
> > > Den tisdag 15 augusti 2017 kl. 16:36:20 UTC+2 skrev jonas.t...@gmail.com:
> > > > Den tisdag 15 augusti 2017 kl. 16:31:26 UTC+2 skrev jonas.t...@gmail.com:
> > > > > Den tisdag 15 augusti 2017 kl. 13:49:13 UTC+2 skrev JJ:
> > > > > > On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote:
> > > > > > > But
> > > > > > > i wan't windows filedialog to open on click of "text,link, button,
> > > > > > > whatever" to write or set the id? before i call the save function. Is
> > > > > > > that possible?
> > > > > >
> > > > > > Write or set the ID of what? Either way, just do all those things before
> > > > > > calling the `click()` method of the link element.
> > > > >
> > > > > The id must be the file that is to be saved?
> > > > > I want it set from windows file save dialog.
> > > > > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save.
> > > >
> > > > But it seem to be alot harder i can not even get the file save dialog of windows to open? Well i can get a file to save use input ID="filename" but i do not want a textfield in menu i want to use microsoft file dialog to set the ID.
> > > >
> > > > If i could do it for open it should be possible for save?
> > >
> > > Here is how i managed to do it for open file it take the ID="filename" from windows file dialog and then open that file.
> > >
> > > <label class="custom-file-upload">
> > > <input type="file"/ id="fileToLoad" onchange="loadFileAsText()">
> > > Load File
> > > </label>
> > >
> > > But i just can't figure out a way even to open the filesave dialog, and i really looked hard for examples on the web but they fetch id from HTML/SCRIPT dialog before saving file i want the ID by microsoft save dialog?
> >
> > Maybe it is confusing for you if you see it as a save of an already open file,that do not need a file dialog just to have the ID set upon open.
> > Think of it as a save as or a new file i want windows save file dialog to open but i don't even find examples of howto do it?
>
> Just to be clear i talk about local file system to open savedialog, not serverside. You can try search there just isn't any example of anyone manage to do it?
What would had make sense to me
<label class="custom-file-upload">
<input type="load"/ id="fileToLoad" onchange="loadFileAsText()">
Load File
</label>
<label class="custom-file-download">
<input type="save"/ id="fileToSave" onchange="SaveFileAsText()">
Load File
</label>
Now there is only the type="file" and that will only open the save file dialog, is there a way to circumvent this and get the save dialog to open?
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-15 08:45 -0700 |
| Message-ID | <56a27c27-4342-4c5c-b215-565fdfdb7e4b@googlegroups.com> |
| In reply to | #33790 |
Den tisdag 15 augusti 2017 kl. 17:27:02 UTC+2 skrev jonas.t...@gmail.com: > Den tisdag 15 augusti 2017 kl. 17:06:17 UTC+2 skrev jonas.t...@gmail.com: > > Den tisdag 15 augusti 2017 kl. 16:49:29 UTC+2 skrev jonas.t...@gmail.com: > > > Den tisdag 15 augusti 2017 kl. 16:42:55 UTC+2 skrev jonas.t...@gmail.com: > > > > Den tisdag 15 augusti 2017 kl. 16:36:20 UTC+2 skrev jonas.t...@gmail.com: > > > > > Den tisdag 15 augusti 2017 kl. 16:31:26 UTC+2 skrev jonas.t...@gmail.com: > > > > > > Den tisdag 15 augusti 2017 kl. 13:49:13 UTC+2 skrev JJ: > > > > > > > On Tue, 15 Aug 2017 03:43:23 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > > > > > > > But > > > > > > > > i wan't windows filedialog to open on click of "text,link, button, > > > > > > > > whatever" to write or set the id? before i call the save function. Is > > > > > > > > that possible? > > > > > > > > > > > > > > Write or set the ID of what? Either way, just do all those things before > > > > > > > calling the `click()` method of the link element. > > > > > > > > > > > > The id must be the file that is to be saved? > > > > > > I want it set from windows file save dialog. > > > > > > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save. > > > > > > > > > > But it seem to be alot harder i can not even get the file save dialog of windows to open? Well i can get a file to save use input ID="filename" but i do not want a textfield in menu i want to use microsoft file dialog to set the ID. > > > > > > > > > > If i could do it for open it should be possible for save? > > > > > > > > Here is how i managed to do it for open file it take the ID="filename" from windows file dialog and then open that file. > > > > > > > > <label class="custom-file-upload"> > > > > <input type="file"/ id="fileToLoad" onchange="loadFileAsText()"> > > > > Load File > > > > </label> > > > > > > > > But i just can't figure out a way even to open the filesave dialog, and i really looked hard for examples on the web but they fetch id from HTML/SCRIPT dialog before saving file i want the ID by microsoft save dialog? > > > > > > Maybe it is confusing for you if you see it as a save of an already open file,that do not need a file dialog just to have the ID set upon open. > > > Think of it as a save as or a new file i want windows save file dialog to open but i don't even find examples of howto do it? > > > > Just to be clear i talk about local file system to open savedialog, not serverside. You can try search there just isn't any example of anyone manage to do it? > > What would had make sense to me > <label class="custom-file-upload"> > <input type="load"/ id="fileToLoad" onchange="loadFileAsText()"> > Load File > </label> > > <label class="custom-file-download"> > <input type="save"/ id="fileToSave" onchange="SaveFileAsText()"> > Load File > </label> > > Now there is only the type="file" and that will only open the save file dialog, is there a way to circumvent this and get the save dialog to open? Well it ain't critical with a savedialog box to open, but it could have looked a bit nicer without input field in menu, it is really buttugly, but i do not longer think it is possible to open windows savedialog using javascript.
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2017-08-16 09:10 +0700 |
| Message-ID | <1ent9ah3ssu7c$.1m52mhsvbgl27.dlg@40tude.net> |
| In reply to | #33785 |
On Tue, 15 Aug 2017 07:31:15 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > The id must be the file that is to be saved? > I want it set from windows file save dialog. > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save. After a file has been selected (at `change` event), read its `name` property. e.g. var filename = inputElement.files[0].file.name;
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-16 04:06 -0700 |
| Message-ID | <238aabec-47ea-42b5-b0a3-5be1e2a82599@googlegroups.com> |
| In reply to | #33792 |
Den onsdag 16 augusti 2017 kl. 04:10:14 UTC+2 skrev JJ: > On Tue, 15 Aug 2017 07:31:15 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > > > The id must be the file that is to be saved? > > I want it set from windows file save dialog. > > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save. > > After a file has been selected (at `change` event), read its `name` > property. e.g. > > var filename = inputElement.files[0].file.name; Hello JJ my problem is not to set the name property, i can both oper and save the files. I do not know howto to open the filesavedialog, and since there is no examples on the web i do not think it is possible. Maybe for some security reason, but i can't see how it possibly could differ saving the file by enter its name using input field in Javascript. If someone just could point me to an example on howto open the filesave dialog of windows i am sure i will be able to set the ID just fine.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-16 05:27 -0700 |
| Message-ID | <1171b907-f6f1-4677-afb4-d4c4279cf132@googlegroups.com> |
| In reply to | #33793 |
Den onsdag 16 augusti 2017 kl. 13:06:52 UTC+2 skrev jonas.t...@gmail.com: > Den onsdag 16 augusti 2017 kl. 04:10:14 UTC+2 skrev JJ: > > On Tue, 15 Aug 2017 07:31:15 -0700 (PDT), jonas.thornvall@gmail.com wrote: > > > > > > The id must be the file that is to be saved? > > > I want it set from windows file save dialog. > > > If you check script you see i managed to do it for file opening, it get the id directly from windows open file dialog without the necessity to write the filename. I would like the same approach for save. > > > > After a file has been selected (at `change` event), read its `name` > > property. e.g. > > > > var filename = inputElement.files[0].file.name; > > Hello JJ my problem is not to set the name property, i can both oper and save the files. I do not know howto to open the filesavedialog, and since there is no examples on the web i do not think it is possible. Maybe for some security reason, but i can't see how it possibly could differ saving the file by enter its name using input field in Javascript. > > If someone just could point me to an example on howto open the filesave dialog of windows i am sure i will be able to set the ID just fine. This is what i've fiddled together so far, i've tried to keep it simple to the maximum. Please try out and comment, and if anyone know howto open windows filed dialog instead of have an input field i would like to know. http://anybase.co.nf/Filehandle/readwrite.html
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web