Validations while navigation between tabs in Tabview [Nativescript with angular] - nativescript

I have used Tabview in my application. There are six different tabs in component.
I need to do validations while try to navigate to next tab likewise between all the tabs.
Like required field validations, If any required fields are not entered means users can’t able to navigate next tab.
Any idea on this?
Thanks in advance.

You can try this -
XML
<Page>
<TabView selectedIndexChanged="onSelectedIndexChanged">
...
</TabView>
</Page>
TS
export function onSelectedIndexChanged(args) {...}
Based on the selected Index you check for validation and redirect it back to the previous index or route it to Login Screen or whatever.

Related

Show Printable page behaviour

I am developing a web application using Oracle ADF. I need to print a graph from our web application. For this am using show printable page behaviour. Actually I have a page with graph.
I added show Printable behaviour as menu as shown below
when I press Printable View button It is showing entire page as printable view as show below
But I need only graph should be show in printable view as below
How do I achieve this.?? Please help. Thanks in advance.
You can use rendered property on components to prevent printing them:
<af:outputText value="Do not Print Me" rendered="#{adfFacesContext.outputMode!= 'printable'}" id="ot11"/>
More info, here:
https://blogs.oracle.com/jdevotnharvest/entry/how_to_hide_or_show

How to add data in popup using primefaces and ajax call

I am new in JSF, facing a problem while executing GET AJAX request.
I have a icon with a counter (number), once I will do mouse over to the icon it shows a kind of small popup with small list (3 items), kind of same behavior as we have in Social networking sites (Notification icon). Till here All good. Now in my pop up at bottom side, I added a text says "Show more". This should get 3 more items/ notification from the DB via Ajax call and add the response in the popup (without closing the popup), then in total there should be 6 items.
I am not sure how exactly I can achieve this, Please help.
Using <h:outputText value="show more}"> in my xhtml.
In my bean I have a method to getMoreNotification().
Recently I tried with <p:remoteCommand>, but not sure how I can add responce/ data in popup.
Thanks in advance.
Not that difficult
Create a list which is initially populated with 3 items
Create a <p:overlay> with IN that <p:overlay> e.g. a <p:dataList> that shows these list mentioned in 1. Give this component an id, e.g. 'notifications'
When clicking on the 'show more' commandLink, execute the getMoreNotification() via an actionListener and IN that method update the list mentioned in 1. Also make sure you have an update attribute that contains the value of the <p:dataList>.

How to preserve bootstrap dropdown state on Meteor

I have a bootstrap dropdown button for each table row.
When the dropdown is clicked it shows a small form with some input fields.
When the user submits this form data or the row gets redrawn the dropdown closes.
I tried preserving the dropdown state using the Template.preserve() method, similar to inputs but with no success.
Some suggested using {{#constant}} directive surrounding the dropdown I also have some reactive content inside the form that needs re-rendering, so this options is not for me.
I have noticed this issue with reactive templates and there is no good solution that I know of. This is somewhat of a hack but it works.
Option 1
Manually add and remove a css class to your dropdown. Use session variables to save the state of the dropdown.
This should be the default state of your dropdown... class="dropdown"
When a user clicks on the dropdown use a session variable to save its state and add 'open' to the HTML class attribute. class="dropdown open"
When a user closes the dropdown remove 'open'
Option 2:
1. User clicks dropdown button.
2. Save dropdown button ID as active using a session variable.
3. Use the following callback to reopen your dropdown... Template.myTemplate.rendered = function ( ) {
if (dropdown = active) {
$().dropdown('toggle'); //instead of toggle try 'open'
}
}
I haven't tried this with dropdowns yet but I was having the same issue with modals disappearing every time the template kept rendering. I tried the second option and it didn't work that great. I ended up using something like the first option to solve the issue and it worked great.

Want to add custom option from the frontend of magento

I want to add a button on product view page. By clicking on that button, there will appear two text box fields which are custom options. When I open that product from the backend, I can find that there are custom options which I added, but I need to view it in the frontend by clicking the button only.
First of all, Products are added by the administrator, and are fully controller also by the Administrator. Only thing is that you (as a customer) can only see the custom options which are available for a particular product (and as provided by the admin).
In your particular case, go to the proper Admin page (Edit / Add a new Product and go to its "Custom Options" tab). Now provide options for two text fields, with two different labels, and then save that product. Now if you go to the front-end to view that product, you will find the product details, along with the two custom options added from the admin section.
Also if you want to add a button in the front-end of each product view page, which when clicked will show the custom options, then you need to create a button & write a JavaScript for opening the container of the Custom Options.
Hope it helps.
Edit:-
First find out the full HTML section of the Custom Options, or in other words, the HTML container of the Custom Options in the Product view page. Provide a unique "id" to the container "DIV" element and make that element hidden. Also provide the HTML button anywhere in the view page, and call the unique ID of the "DIV" element in the "onclick" event of the button. A simple code snippet will be like:-
<div id="any_unique_id" style="display: none;">
// Whole Custom Options
</div>
<button onclick="$('any_unique_id').show();">Click here to view the Custom Options</button>
checkout Knowledge Craving 2nd part's answer

Custom "Next" Buttons for Spring MVC AbstractWizardFormController

Currently, a spring application I am working on has several wizards that it is using with Spring's AbstractWizardFormController. During the early stages of development(pre-design phase), the type of "next" button did not matter.
Just to refresh, the Next and Back button are submit buttons with target attributes. So a next button on the first page of a wizard would look like the following.
<input type="submit" name="_target1" value="Next"/>
This is the standard way Spring does wizards on the view. This works fine, given that you want your Next button to be a standard HTML submit button. Otherwise, in my case, If I want a custom button, I am not sure how to do this. I know it is possible, but haven't found any documentation.
I imagine I will need to do a javascript submit, but I am not sure how to set the name of the button, of if something else needs to be done.
I just need to know how I can still extend AbstractWizardFormController, and use custom buttons.
When clicked, HTML submit button submits a form with additional parameter {name}={value}, that is _target1=Next. I guess the value doesn't matter here, controller looks at the name. So, if you want to emulate this with Javascript, you may, for example, dynamically add a hidden field with name = "_target1" before submit.

Resources