Reputation: 75
I need to remove the Input field element, when the type is hidden, when I'm selecting hidden type for control type in another tab from autocomplete type, the value is getting hide in display. but in the console(F12) is showing like below with the value:
<div id="ember30156" class="ember-view hidden field" core-role="utility-field" aria-label="Non hidden">
<input id="ember30193" class="ember-view ember-text-field hidden text-field component" type="hidden" name="non-hidden" value="I am Hidden">
</div>
In the network field also showing like below with the value
------WebKitFormBoundaryMUmkbDAG6Iw0D4Xj
Content-Disposition: form-data; name="hidden"
I am Hidden
------WebKitFormBoundaryMUmkbDAG6Iw0D4Xj
Content-Disposition: form-data; name="rc"
1
------WebKitFormBoundaryMUmkbDAG6Iw0D4Xj--
But I need to hide the values from the both element and network tab of console. Here is my code
Core.view.Form.Field.extend()
.named('Core.view.Form.Field.hidden')
.reopen({
template: Ember.Handlebars.compile('{{#each value in view.model.values}}{{view view.field name=view.model.name value=value}}{{/each}}'),
field: Ember.TextField.extend({
type: "hidden",
attributeBindings: ['name', 'value'],
classNames: 'hidden',
noLabel: true
})
});
I'm new to the ember.
Upvotes: 1
Views: 210
Reputation: 2276
I am not sure what you mean by hiding it from the network, but to make the input not show up at all in the DOM, you can use an if helper in your template hbs:
{{#if showInput}}
{{input value=something}}
{{/if}}
Then in the component JavaScript:
this.set(‘showInput`, true)
to reveal it. There are examples of the if helper in the docs and the guides. I recommend doing the official tutorial as you are learning. Good luck :)
This answer applies from 1.13 to 3.x at least.
Upvotes: 5