FullCalendar example with database in struts1 - fullcalendar

I am new to struts. Iam developing applcation using struts.Can anyone help in the code for fullcalendar in struts with database ?

Sure just populate your bean with your json to populate the calendar. Then use a define tag on the page and use it to populate your calendar. Here is a simple example.
<bean:define id="calendarJson" name="formName" property="bean.calendarJson" />
<script>
$(document).ready(function() {
$('#calendar').fullCalendar(
<%= calendarJson %>
);
});
</script>
<div id="calendar" class="myFullCalendar"></div>

Related

asp.net mvc 5 date picker in form without any model

inside the page which is belong to other model and here I need only one input which should have date picker. I don't want I select type in model but here in html, is there any helper or library?
You just have to add required jQuery files or libraries as below for jQuery DatePicker: (If you are using bundling in ASP.NET MVC, then use the following. By the way, bundling means to add all jQuery or CSS files in a single class for optimization)
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css",
"~/Content/jquery-ui.css"));
Or simply without bundling, you can do the following as well:
<script type = "text/javascript"
src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
In the head section:
<script >
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
Then finally:
<p>Date: <input type="text" id="datepicker" /></p>
For more, you can check the below links:
Sample-jQuery-DatePicker-01
jQuery-Plugin-Samples
Sample-jQuery-DatePicker-02

expression is not getting binded in asp.net application using angularjs

I am binding the angular java script expression to bind the simple value i have written in controller function.
here is my webpage code that is created using master page,
<div class="dashboard-content-wrap auto-padding" ng-app="myModule" ng-controller="myController">
<div>
{{employee.name}}--{{employee.country}}--{{1+2}}
</div>`enter code here`
and given below is js file code,
var myApp = angular.module("myModule", [])
.controller("myController", function ($scope) {
var employee={name:"john",country:"US"};
$scope.employee = employee;
});
i am not able to bind this value in my web page please help?
I dont see any problem with your code except a missing div tag.
<body>
<div class="dashboard-content-wrap auto-padding" ng-app="myModule" ng-controller="myController">
<div>
{{1+2}}
{{employee.name}}--{{employee.country}}--{{1+2}}
</div>
</div>
</body>
Please see if this fiddle helps you.

Submitting form in angularjs in asp.net web page

I am hating asp.net...
I have a really simple web site. In my master page I have a form runat="server".. I need it because in some page I have server side controls (login control for example, or my custom control)..
Now I have a simple page, with a really simple form. And in this page, I would like to use angularjs..
What I want is that (simply) when I submit this angularjs form, I arrive on the server just when the form is valid.
In this page I have tried different solution but no solution works!
The problem I think is that I have a (angularjs) form (in the page, this is not runat="server") that is nested in asp.netform (in the master page, runat="server")..
Here what I tried:
1) remove the asp.net form from the master page and add different asp.net form just where i need, but in some page i had more than one form with `runat="server" and this is not possible:
two form runat=server
2)remove the angularjs form, don't do a submit, but manage a simple ng-click event, but in this way I go on server always, even if form is not valid...
3)leave the angularjs form a do a submit, but in this way I obtain an "invalid postback error"... I have tired this solution but it does not work:
Invalid postback error
What I simply want is to use angularjs and go on server just when form is valid... How can I do? Thank you..
UPDATE:
My MasterPage is:
<body>
<form runat="server">
...
<asp:ContentPlaceHolder ID="content" runat="server"></asp:ContentPlaceHolder>
...
</form>
</body>
My Page is:
<asp:Content ID="Content3" ContentPlaceHolderID="content" runat="server">
<script type="text/javascript" src="/Scripts/angular.min.js"></script>
<script type="text/javascript" src="/Scripts/angular-resource.min.js"></script>
<script type="text/javascript">
(function (angular) {
var public_area = angular.module("public-area", ['ngResource']);
public_area.factory("PresentaUnAmicoService", function ($resource) {
return {
piani_tariffari: $resource("/api/PresentaUnAmico/")
};
});
public_area.controller("PresentaUnAmicoController", function ($scope, PresentaUnAmicoService) {
$scope.sendInvitation = function ()
{
var invitation =
new PresentaUnAmicoService
.piani_tariffari($scope)
.$save();
}
});
})(angular);
</script>
<div data-ng-app="public-area" data-ng-controller="PresentaUnAmicoController">
<form name="presenta_amico-form" novalidate>
<table class="three_column" data-ng-class="{ 'ng-submitted' : submitted }">
... //Here there is my form
<button type="button" class="button link" id="btnSendInvitation" runat="server" data-ng-click="submitted=true" ng-submit="sendInvitation()">
<span><b>INVIA EMAIL</b></span> <img class="middle" src="/Styles/img/continue_24x24.png" />
</button>
...
</table>
</form>
</div>
</asp:Content>
I Know, It's not correct have a form inside another form.. but I am looking for a solution...
What you need in order to nest form is to use
eg:
<form runat="server">
<ng-form name="myFormName" ...>
//Your Code
</ng-form>
</form>
have a look here

use custom validator to disable textbox if another is empty

In my project I have to give user option to put a security question and answer to this question, so I have two textboxes one for question and another one for the answer, I want to use ASP.net custom validators to do this task so if question textbox is empty answer textbox will be disabled and when question textbox is not empty answer textbox is enabled.
A validator is not fired if the textbox is empty. But you can set the attribute ValidateEmptyText="true" on your CustomValidator to bypass this.
JavaScript is good enough here:
<html>
<head>
<script type="text/javascript">
var minimumQuestionLength = 20;
function checkQuestionBox()
{
var questionLength=document.getElementById("question").value.length;
if(questionLength < minimumQuestionLength)
{
return false;
}
return true;
}
</script>
</head>
<body>
<h1 id="myHeader">Test</h1>
<p>Question: <input type="text" id="question"/><br />
Answer: <input type="text" id="answer" onkeypress="return checkQuestionBox();"/>
</p>
</body>
</html>
Fairly simple. You can also disable "answer" on start and then enable once the question is correct, if you prefer that option. Also simple JavaScript.

asp.net mvc javascript postback

I'm mixing asp.net webforms and asp.net-mvc. To use webforms I've included
routes.IgnoreRoute("Reports/{*pathInfo}");
in the public static void RegisterRoutes(RouteCollection routes) method.
It seems to work just fine. But javascript postbacks on the asp.net webform pages don't work. Specifically
<script type="text/javascript">
function callMethod(methodName, methodArgument)
{
alert('test1');
document.getElementById("methodname").value=methodName;
document.getElementById("methodargument").value=methodArgument;
alert('test2');
document.forms[0].submit();
}
</script>
doesn't work. Everything is fine until the document.forms[0].submit(); call which appears to do nothing. If I completely disable the asp.net MVC route mapping then the above Javascript works just fine.
I just completed a brand new sample project and was able to get this to work... I created a folder in the root of my project called Reports and added the Billing.aspx page there. I then added the code below to the default Index view within the Home folder as shown below.
Global.asax
routes.IgnoreRoute("Reports/{*pathInfo}");
MVC Page Views\Home\Index.aspx
<form method="post" action="../../Reports/Billing.aspx?tenantId=0003-0140&rentNum=0" id="myForm">
<input type="text" id="sample" /><br />
<input type="button" onclick="callMethod();" value="send" />
</form>
<script type="text/javascript">
function callMethod()
{
alert('test1');
alert(document.getElementById("sample").value);
alert('test2');
document.forms[0].submit();
}
</script>
My guess is that even though your form's action is set to Billing.aspx, it is not looking for it in the correct folder. Try adding "../../Reports/" in front of Billing.aspx to your form's action. Since the Billing page is not in the same root as the MVC page, that is likely to not go anywhere on a post action...

Resources