Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33773 > unrolled thread
| Started by | justaguy <lichunshen84@gmail.com> |
|---|---|
| First post | 2017-08-14 12:56 -0700 |
| Last post | 2017-08-23 03:39 +0200 |
| Articles | 9 — 6 participants |
Back to article view | Back to comp.lang.javascript
Further question on cloneNode justaguy <lichunshen84@gmail.com> - 2017-08-14 12:56 -0700
Re: Further question on cloneNode Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-08-15 08:23 +0200
Re: Further question on cloneNode JJ <jj4public@vfemail.net> - 2017-08-15 18:34 +0700
Re: Further question on cloneNode justaguy <lichunshen84@gmail.com> - 2017-08-16 14:01 -0700
Re: Further question on cloneNode jonas.thornvall@gmail.com - 2017-08-18 06:23 -0700
Re: Further question on cloneNode Flng Fck <nothanks@invalid.invalid> - 2017-08-18 17:03 +0200
Re: Further question on cloneNode jonas.thornvall@gmail.com - 2017-08-18 08:26 -0700
Re: Further question on cloneNode JJ <jj4public@vfemail.net> - 2017-08-21 21:40 +0700
Re: Further question on cloneNode Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-23 03:39 +0200
| From | justaguy <lichunshen84@gmail.com> |
|---|---|
| Date | 2017-08-14 12:56 -0700 |
| Subject | Further question on cloneNode |
| Message-ID | <7f01b318-01b0-49a4-80ea-b3498b37ab3b@googlegroups.com> |
When a clone source object has multiple input fields (see the following URL). if they are of type TEXT and with value, I want the clone target object to have the blank TEXT fields instead (no problem) and if they are of type checkbox, I'd like them unchecked by default for all the checkbox fields in the target object (cloned object). Additional note: Each Checkbox field is immediately followed by an input Text field and the Rule is if the checkbox is checked then this input Text field must have value. My first attempt was to set all the checkbox fields in the clone target object to false. Result: all the checkbox fields in the clone target object appears not checked, however, it's misleading because the form is submitted checkbox fields carry the same property of its source (before cloning), for instance, when D1 is cloned with D3 checked, the new D1 (cloned D1) has D3 unchecked, however, D3 in the cloned D1 is marked as required. My second attempt was to first set the checkbox fields in the source object to false right before cloning and then turn the checkbox fields to true if they are true in the first place. It won't work neither. I guess because of object property inheritance (so, it turns the checkbox fields in the clone target object as well). Thoughts? Thanks. http://54.80.71.115/dev/D1.html
[toc] | [next] | [standalone]
| From | Cezary Tomczyk <cezary.tomczyk@gmail.com> |
|---|---|
| Date | 2017-08-15 08:23 +0200 |
| Message-ID | <omu40s$1pha$1@csiph.com> |
| In reply to | #33773 |
On 14/08/2017 21:56, justaguy wrote: > When a clone source object has multiple input fields (see the following URL). [...] Regarding cloneNode it's worth to read notes as the cloneNode method doesn't clone node in a way it's expected: https://developer.mozilla.org/en/docs/Web/API/Node/cloneNode#Notes -- Cezary Tomczyk http://www.ctomczyk.pl/
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2017-08-15 18:34 +0700 |
| Message-ID | <1gyqyuoy8jtmh$.1w4q3dxmda692$.dlg@40tude.net> |
| In reply to | #33773 |
On Mon, 14 Aug 2017 12:56:38 -0700 (PDT), justaguy wrote: > When a clone source object has multiple input fields (see the following > URL). > > if they are of type TEXT and with value, I want the clone target object > to have the blank TEXT fields instead (no problem) and if they are of > type checkbox, I'd like them unchecked by default for all the checkbox > fields in the target object (cloned object). > > Additional note: Each Checkbox field is immediately followed by an input > Text field and the Rule is if the checkbox is checked then this input > Text field must have value. > > My first attempt was to set all the checkbox fields in the clone target > object to false. Result: all the checkbox fields in the clone target > object appears not checked, however, it's misleading because the form is > submitted checkbox fields carry the same property of its source (before > cloning), for instance, when D1 is cloned with D3 checked, the new D1 > (cloned D1) has D3 unchecked, however, D3 in the cloned D1 is marked as > required. > > My second attempt was to first set the checkbox fields in the source > object to false right before cloning and then turn the checkbox fields to > true if they are true in the first place. It won't work neither. I > guess because of object property inheritance (so, it turns the checkbox > fields in the clone target object as well). > > Thoughts? > > Thanks. > > http://54.80.71.115/dev/D1.html My suggestion is to clone the node when the page has finished loading. i.e. when the checkboxes are still unchecked and the text inputs are still blanks. Save the cloned node into a variable as the templace node and don't place it into the document. When you need to clone the node, clone the template node then place the newly cloned node into document.
[toc] | [prev] | [next] | [standalone]
| From | justaguy <lichunshen84@gmail.com> |
|---|---|
| Date | 2017-08-16 14:01 -0700 |
| Message-ID | <42cd59d8-b76c-4149-93ad-2f949adfdfdf@googlegroups.com> |
| In reply to | #33783 |
On Tuesday, August 15, 2017 at 7:35:01 AM UTC-4, JJ wrote: > On Mon, 14 Aug 2017 12:56:38 -0700 (PDT), justaguy wrote: > > When a clone source object has multiple input fields (see the following > > URL). > > > > if they are of type TEXT and with value, I want the clone target object > > to have the blank TEXT fields instead (no problem) and if they are of > > type checkbox, I'd like them unchecked by default for all the checkbox > > fields in the target object (cloned object). > > > > Additional note: Each Checkbox field is immediately followed by an input > > Text field and the Rule is if the checkbox is checked then this input > > Text field must have value. > > > > My first attempt was to set all the checkbox fields in the clone target > > object to false. Result: all the checkbox fields in the clone target > > object appears not checked, however, it's misleading because the form is > > submitted checkbox fields carry the same property of its source (before > > cloning), for instance, when D1 is cloned with D3 checked, the new D1 > > (cloned D1) has D3 unchecked, however, D3 in the cloned D1 is marked as > > required. > > > > My second attempt was to first set the checkbox fields in the source > > object to false right before cloning and then turn the checkbox fields to > > true if they are true in the first place. It won't work neither. I > > guess because of object property inheritance (so, it turns the checkbox > > fields in the clone target object as well). > > > > Thoughts? > > > > Thanks. > > > > http://54.80.71.115/dev/D1.html > > My suggestion is to clone the node when the page has finished loading. i.e. > when the checkboxes are still unchecked and the text inputs are still > blanks. Save the cloned node into a variable as the templace node and don't > place it into the document. > > When you need to clone the node, clone the template node then place the > newly cloned node into document. Thanks all. It seem another method is to have an identical DIV with a different ID and not to display it, then it would appear to be cloning the original one. However, it creates some hassle for the FORM processing because it would an empty array to all the affected input elements. Personally I'd stay with the minor inconvenience of having to uncheck the cloned checkbox fields within a group vs. faking a DIV (the new method mentioned here) and making the FORM processing less efficient and the possibility of array messing-up.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-18 06:23 -0700 |
| Message-ID | <d2229d94-33dd-44db-801b-83665052b396@googlegroups.com> |
| In reply to | #33799 |
Den onsdag 16 augusti 2017 kl. 23:01:38 UTC+2 skrev justaguy: > On Tuesday, August 15, 2017 at 7:35:01 AM UTC-4, JJ wrote: > > On Mon, 14 Aug 2017 12:56:38 -0700 (PDT), justaguy wrote: > > > When a clone source object has multiple input fields (see the following > > > URL). > > > > > > if they are of type TEXT and with value, I want the clone target object > > > to have the blank TEXT fields instead (no problem) and if they are of > > > type checkbox, I'd like them unchecked by default for all the checkbox > > > fields in the target object (cloned object). > > > > > > Additional note: Each Checkbox field is immediately followed by an input > > > Text field and the Rule is if the checkbox is checked then this input > > > Text field must have value. > > > > > > My first attempt was to set all the checkbox fields in the clone target > > > object to false. Result: all the checkbox fields in the clone target > > > object appears not checked, however, it's misleading because the form is > > > submitted checkbox fields carry the same property of its source (before > > > cloning), for instance, when D1 is cloned with D3 checked, the new D1 > > > (cloned D1) has D3 unchecked, however, D3 in the cloned D1 is marked as > > > required. > > > > > > My second attempt was to first set the checkbox fields in the source > > > object to false right before cloning and then turn the checkbox fields to > > > true if they are true in the first place. It won't work neither. I > > > guess because of object property inheritance (so, it turns the checkbox > > > fields in the clone target object as well). > > > > > > Thoughts? > > > > > > Thanks. > > > > > > http://54.80.71.115/dev/D1.html > > > > My suggestion is to clone the node when the page has finished loading. i.e. > > when the checkboxes are still unchecked and the text inputs are still > > blanks. Save the cloned node into a variable as the templace node and don't > > place it into the document. > > > > When you need to clone the node, clone the template node then place the > > newly cloned node into document. > > Thanks all. > > It seem another method is to have an identical DIV with a different ID and not to display it, then it would appear to be cloning the original one. However, it creates some hassle for the FORM processing because it would an empty array to all the affected input elements. > > Personally I'd stay with the minor inconvenience of having to uncheck the cloned checkbox fields within a group vs. faking a DIV (the new method mentioned here) and making the FORM processing less efficient and the possibility of array messing-up. It will be alot easier when we do communicate, if we do it in the same thread lowIQ people who think they are smart is just annoying. I maybe sloppy but i still have my 178 IQ so i removed the cloned <div class="dropdown"> so you anal pricks can move on with your life, you see i did just copy paste from another project where i did same mistake. So any chance you could tell me if there is any chance i will be able to open the savedialog from javascript? Sorry about the anal prick remark but i felt it was justified. http://anybase.co.nf/Filehandle/readwrite.html
[toc] | [prev] | [next] | [standalone]
| From | Flng Fck <nothanks@invalid.invalid> |
|---|---|
| Date | 2017-08-18 17:03 +0200 |
| Message-ID | <on6vc7$a5p$1@dont-email.me> |
| In reply to | #33800 |
Il 18/08/2017 15:23, jonas.thornvall@gmail.com ha scritto: > So any chance you could tell me if there is any chance i will be able to open the savedialog from javascript? > > Sorry about the anal prick remark but i felt it was justified. > > http://anybase.co.nf/Filehandle/readwrite.html It appears as expected, on Chrome 60.0.3112.101 (Build ufficiale) (64 bit) on WIndows 10, and saves the text correctly to a txt file
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-08-18 08:26 -0700 |
| Message-ID | <a6dfafcf-e4f2-48b7-9255-63f3184d3339@googlegroups.com> |
| In reply to | #33802 |
Den fredag 18 augusti 2017 kl. 17:03:45 UTC+2 skrev Flng Fck: > Il 18/08/2017 15:23, jonas.thornvall@gmail.com ha scritto: > > So any chance you could tell me if there is any chance i will be able to open the savedialog from javascript? > > > > Sorry about the anal prick remark but i felt it was justified. > > > > http://anybase.co.nf/Filehandle/readwrite.html > > > It appears as expected, on Chrome 60.0.3112.101 (Build ufficiale) (64 > bit) on WIndows 10, and saves the text correctly to a txt file Yes i know "but for the last time" is there a way to open windows savedialog so i can get rid of the fucking input field in the menu? Either there is, or not, do anyone know, it is a simple "yes you can" point to example or "no you can't" question?
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2017-08-21 21:40 +0700 |
| Message-ID | <1wxbjx0onyclf.8050zhqrgkq.dlg@40tude.net> |
| In reply to | #33803 |
On Fri, 18 Aug 2017 08:26:28 -0700 (PDT), jonas.thornvall@gmail.com wrote: > Yes i know "but for the last time" is there a way to open windows > savedialog so i can get rid of the fucking input field in the menu? > > Either there is, or not, do anyone know, it is a simple "yes you can" > point to example or "no you can't" question? Yes, you can. Store the original file name which was previously chosen from the open-file dialog into the `download` attribute of an `A` element (instead of an `INPUT` element). Call the `click()` method of that `A` element to display the save-file dialog (and download the URL pointed by that `A` element). The `A` element must be placed into the document in order to work. Hide the `A` element if necessary. <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download>
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2017-08-23 03:39 +0200 |
| Message-ID | <7377037.NyiUUSuA9g@PointedEars.de> |
| In reply to | #33845 |
JJ wrote: > Store the original file name which was previously chosen from the > open-file dialog into the `download` attribute of an `A` element (instead > of an `INPUT` element). Call the `click()` method of that `A` element to > display the save-file dialog (and download the URL pointed by that `A` > element). The `A` element must be placed into the document in order to > work. In Chromium, this triggers a confirmation dialog of the form | [x] | http://example/ wants to: | | [v] Download multiple files | | [ Block ] [ Allow ] Since the `download` attribute is an HTML5 feature, it might be better to trigger a server-side script that suggests the download instead. -- PointedEars FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web