Meteor form component rendering - meteor

Whats "best practice" for rendering components in a form based on user input?
I want a second input field added to the form when a user clicks option 2 on the dropdown button. I also want this if show cleared when a user clicks another option.
<form>
<button class='test'>my dropdown button with option 1,2,3</button>
<input type=text> input field 1</input>
<!-- if button clicked options 2, add second input field -->
<input type=text>input field 2</input>
</form>
Template.name.events({
'click .test': function() {
// something to render input field 2
}
)};
Thank you.

You can show your elements on conditional basis with helpers.On your second button click you can set a session and use it in a helper.Then in your html page use {{#if}} your element {{/if}}
And for clearing it , destroy this session.
Hope this make sense to you.If any query lmk

Related

Google appmaker how to have a password type input (hidden text)?

I want to have a password input as simple as the HTML regular type="password" input (i.e.,
<input type="password" id="password_field">). Are there any built in styles (maybe like 'required') that does that? If not how can I have an obfuscated text field?
I was thinking perhaps I could use the HTML widget and add it there but I am not sure how to access the input's value within the HTML widget. I can imagine it can be done with jQuery, but I do not want to use it.
Code inside the onAttach event handler of your TextBox widget:
widget.getElement().children[1].setAttribute("type", "password");
widget.getElement().children[1].setAttribute("id", "password_field");

Add label-element to managed_file field with Form API

I want to style my managed_file-Field in a Drupal 7 Form-API custom form and therefore, insert a label element that will replace the "Browse for file".
So I want exactly this:
<input type="file" name="files[bild_0]">
<input type="submit" id="edit-bild-0-upload-button" value="Upload">
<label for="files[bild_0]">Choose Picture</label>
However, the Form API makes it very difficult to insert the label directly next to the input. "#prefix" and "#suffix" are not working. "#field_prefix" and "#field_suffix" inserted the html in a wrapper...any ideas?
Thank you very much in advance!
So, i finally figured out an alternative solution. I used the
'#field_suffix'
property on the Form API field to add the label element. Besides of that, I had to overwrite the initial id of the field via
'#id' => 'upload-selector-' . $index_of_picture field
Since the id of the actual input-field is now different from the div that contains the field, I could use the label of the field to trigger the file-dialog. I styled the label element to my needs and hid the initial input.

CSS Loading on click of submit button

I am building an advanced search form, and upon submit of criteria it brings back search results.
I wanted to implement a page loader for this, so on submit it then triggers the loading of the page
This tutorial works for the page itself
https://www.w3schools.com/howto/howto_css_loader.asp
Can anyone help me make this work when the submit button is clicked instead?
You can use JavaScript to show your loader when your submit button is clicked by adding at to the button directly
<input type="submit" onclick="document.getElementById(ID_OF_YOUR_LOADER).style.display='initial';">
or in a separate script-Tag:
<script>
document.getElementById(ID_OF_YOUR_SUBIMT_BUTTON).onclick=function(){
document.getElementById(ID_OF_YOUR_LOADER).style.display='initial';
}
</script>
Your loader would look like this:
<div id="ID_OF_YOUR_LOADER" class="loader" style="display:none"></div>

Pass flexible parameters PL/SQL

I have my webpage, where I have 10 rows, and in every rows is input field (checkbox). I want to create button with title 'Detail'. When I click on this button, my webpage open new page only with checked rows.
Task is, that I need to send every checkbox into detail button, and I don´t know, how much rows will be displayed (depend on database). I need to create function with input flexible parameters (name_array and value_array). But when I create this function, my arrays are empty. What I´m doing bad? Thank you for your response.
I dont have any form, I want to do that without form element.
This is my checkbox:
<input type="checkbox" id="id_netnum_5356963" netnum="5356963" />
And this is my button to detail:
<a href="!cpc2.pkg_fe_netnum_gui.p_detail_numbers">
<button>
<span class="btn-green-small btn-w130">Detail</span>
</button>
</a>
You should use flexible parameter passing
http://docs.oracle.com/cd/B12037_01/server.101/b12303/concept.htm#1005765

Spring mvc persist data when dijit dialog is closed

I have a create view where the user and fill some data and if they click on a button a dijit.dialog opens with a list of items to select. Everything works fine, except that when the dialog confirms the selected items it goes to the controller to do some logic and refreshes the create view deleting the data that the user filled previously.
How can I make the dialog persist what the user already filled (maybe going to the controller to set the data before opening it)? Or maybe try to close the dialog, refresh the list that I show on the dialog and part of the create view that uses what the user selected.
Not sure if I make myself clear enough.
Edit
My project is based on Spring Roo:
<form:create .....>
.. inputs and tables ..
<input type="button" ../> //goes to controller and loads page with dialog open
<tiles:insertTemplate template="/WEB-INF/views/dialog.jspx" />
</form>
Dialog code:
<div id="dialog" dojoType="dijit.Dialog">
<form id="items" dojoType="dijit.form.Form">
<jsp:doBody/>
<input id="save" type="submit" name="sendDialogData">
</form>
</div>
I thought that would make the dialog part of the form but just checked with firebug and it is created after the "wrapper" (the div that contains everything)

Resources