I have two pages and I need to make one using html and javascript
F.E. First page is a form and second page is a table to work with. So, after user submit the form, page have to update without refreshing. Form have to disappear, and table have to appear instead of it. How can I do it without PHP or frameworks like AngularJS and with #blabla routing or something HTML and JS only?
Related
I have created a form in php which has to fetch data from table1 and dump it into table2 every time user clicks on a link (link provided in a different page). I have written code in a php page (assume eg -> test.php) including html as well. I tried submitting the form onload of the page using Javascript (document.formname.submit) but it keeps on going in an infinite loop and keeps inserting data in table2 again and again.
How do I prevent this and auto form submit only once and still stay on the same PHP (i.e. test.php) page, which also contains the code for displaying detail view of the inserted data in table2?
That's because simply calling submit() on a form fill cause a full page reload. If you want to keep the current approach, you should instead use AJAX call to submit the data from that form.
Read here for more details. The article explains how to do both GET and POST requests using JS.
That sad, your solution seems somewhat ... emm ... hairy. Why exactly are you copying data from no table top another?
Before JavaScript check this condition by using form name.
if ( ! isset($_POST['main']) )
Here main is form name.
I am new to angularjs. I have a html page which I need to include in another html page as pop up (both the html page have contents loaded from controller). It is working fine when I use router to move between pages. But I want the second page to be show as a pop up modal with a button and text box whose value also I need in controller. Simply put I need a preview page before I make the form submit. I went through several sites and they have asked me make use of templates but I am not sure how to use it.
I used bootstrap modal. Make sure you make use of the correct bootstrap version for showing and hiding the modal from javascript file also.
use angular-modal-service. You need to include this service in your controller. This service has the option to edit header and submit option in your controller http://dwmkerr.github.io/angular-modal-service/
I am developing an app using angularJS. This application has about 5 tabs and this is mainly a form and a single submit option for all tabs.(similar to employee data maintenance) The form is loaded with data of the user when the page gets loaded and user can edit and resubmit the form.
Since loading all the 5 tabs in the initial page load will effect the load time of the page , so i am planning to use on demand loading of contents and API.
1st approach:
One thing i can do is loading only 1st tab on initial load and load the other tabs based on click on the tab and using ng-include to include partial views. So in the end user can submit the form and client side validation can be done easily.In this case page will have DOM elements of all activated tabs.
2nd approach: By using routing (i am not much familiar with this). But from my understanding this logic will replace the DOM of a tab when user switches tab unlike 1st approach. So there is a need of using service or some other technique to save the data. But i want to retain the DOM of previous active tab even when tab is switched. So can it be done?
Finally, What is the best approach among above two OR is there any other good techniques to achieve same?
I think Option 2 would work best for you. AngularUI router (https://github.com/angular-ui/ui-router) would help with this above the standard ng-router.
Rather than save the DOM between tab switches, you could just save the data and re-bind when you switch tabs.
I decided to learn AngularJS, but I got stuck on my first project :/
I want to make menu like in first example here: http://tutorialzine.com/2013/08/learn-angularjs-5-examples/ So there are a few options: "home", "projects" etc. and if I click on one I get other part of site without reloading whole page.
What I want to accomplish:
dynamic data loading, when I click on link, refreshes only one part of page not all. I want to make page like this (click on any link - the menu bar sands still and isn't reloaded)
all parts of site are in separate files (I don't want to keep all page data in one html file, I want to break it into pieces)
adress of page (in browsers adress bar) is changing when I click on link
I know I could use AJAX or something like this, but the problem is: I want to make Google-friendly site and - as in know - Google have some problems with AJAX based sites.
Can you tell me what way should I choose and if angularJS actually qualify to this job?
I have Asp.net web application given by client with UI layer and its speaking with webservices. I am creating another asp.net web application copy pasted all the HTML,CSS and images other files.
ERROR :
I have Master page and child page.
In child pages I have lot of JavaScript for validating the text box.
Javascript like:
$(document).ready
rules and messages)
they getting form tag from master for binding.
But when I click the submit button, it's not validation the control
and I have placed alert box inside the JavaScript and its working.
Kindly help here...
alert box is working..and validation is not work in same JavaScript.
How to check the JavaScript is correctly bound with form tag?
Same problem appears in another set of master and Child page. I corrected the form tag. Like master page form tag should be in child page. It's validating properly.
alert outside the $(document).ready to check weather its coming inside the script also can you post the code for futhe