How to use KendoDatePicker within x-kendo-template in .NET Core - asp.net-core

I have a popup editor template working for when I want to add/edit a row in my Kendo grid and it is bound to the model's properties. The issue is that I am unable to get Kendo widgets (e.g. datepicker or dropdownlist) to generate inside the kendo-template (primarily wanting to use taghelpers). Nor have I been able to use jQuery to convert inputs into kendo widgets on $(document).ready(). How can I do this?
My grid:
<kendo-grid name="accountsGrid" height="500" on-detail-init="onDetailInit">
<datasource type="DataSourceTagHelperType.Ajax" page-size="10">
<transport>
<read url="?handler=Accounts&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
<create url="?handler=CreateAccount&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
<update url="?handler=EditAccount&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
</transport>
<schema>
<model id="AccountId">
<fields>
<field name="LastUpdateDate" type="Date"></field>
</fields>
</model>
</schema>
</datasource>
<columns>
<column field="Id" hidden="true" />
<column field="AccountName"
title="Account Name"
header-html-attributes='HeaderHtmlAttribute(title:"Account Name")' />
<column field="LastUpdateDate"
title="Last Updated"
format="{0:MMMM dd, yyyy}"
header-html-attributes='HeaderHtmlAttribute(title:"Last Updated")' />
<column title="Actions"
header-html-attributes='HeaderHtmlAttribute(title:"Actions")'
html-attributes='new Dictionary<string, object> {["class"] = "center-cell" }'>
<commands>
<column-command name="edit" />
</commands>
</column>
</columns>
<toolbar>
<toolbar-button name="create" template="getTelerikButton('Add')" />
</toolbar>
<editable mode="popup" template-id="accountEditorTemplate" />
<pageable button-count="5" refresh="true" page-sizes="new int[] { 5, 10, 20 }">
</pageable>
<scrollable enabled="true" />
My Editor Template:
<script id="accountEditorTemplate" type="text/x-kendo-template">
<div class="row editor-padding">
#*Account Details*#
<div class="col-md-6 col-xs-12">
<h5 class="editorTemplateHeader">Account Details</h5>
<div class="k-edit-label">
<label for="AccountName">Account Name</label>
</div>
<div class="k-edit-field">
<input required type="text" class="k-input k-textbox" name="AccountName" validationmessage="Account Name is required" maxlength="8" />
</div>
<div class="k-edit-label">
<label for="Description">Description</label>
</div>
<div class="k-edit-field">
<input type="text" class="k-input k-textbox" name="Description" maxlength="100" />
</div>
<div class="k-edit-label">
<label for="ExpirationDate">Expiration Date</label>
</div>
<div class="k-edit-field">
#*I would like to do this, but nothing appears*#
<kendo-datepicker name="ExpirationDate"></kendo-datepicker>
</div>
</div>
</div>

I resolved the problem. It involved using data- syntax. Below is the solution:
<div class="k-edit-field">
<input required type="text"
name="ExpirationDate"
data-type="date"
data-bind="value:ExpirationDate"
data-role="datepicker"
validationmessage="Expiration Date is required" />
</div>

Related

Not able to post data to data base Entity Framework Blazor App

I am trying to add form data to database. I am using the entity framework in a blazor application. I am able to retrieve data but not able to add and update.
#using ForAllSeniorCitizens.Models
#inject IDonorService donorService
#inject FASCCDbContext _db
<div class="dashheader d-flex align-items-center pl-4 py-2 bg-cta text-light">
<MatIcon Class="mr-2" Icon="#MatIconNames.Local_florist"></MatIcon> <MatH5 Class="mb-0">Donor Info</MatH5>
</div>
<div class="content p-4 container">
<div class="AddDonor">
<div class="mat-layout-grid">
<div class="mat-layout-grid-inner">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-6">
<MatH4>Add a donor here before recording their donation at Cash Donations or Item Donations</MatH4>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-6">
<EditForm Model="#donor" OnValidSubmit="AddDonor">
<DataAnnotationsValidator />
<MatTextField Label="First Name" #bind-Value="#donor.FirstName" FullWidth="true"></MatTextField>
<ValidationMessage For="#(() => donor.FirstName)" />
<MatTextField Label="Middle Name" #bind-Value="#donor.MiddleName" FullWidth="true"></MatTextField>
<MatTextField Label="First Name" #bind-Value="#donor.LastName" FullWidth="true"></MatTextField>
<ValidationMessage For="#(() => donor.LastName)" />
<MatTextField Label="Email" #bind-Value="#donor.Email" FullWidth="true"></MatTextField>
<ValidationMessage For="#(() => donor.LastName)" />
<MatTextField Label="Phone Number" #bind-Value="#donor.PhoneNumber" FullWidth="true"></MatTextField>
<ValidationMessage For="#(() => donor.PhoneNumber)" />
<MatButton Type="submit">Add</MatButton>
</EditForm>
</div>
</div>
</div>
</div>
#code {
Donor donor = new();
private async Task AddDonor()
{
//await donorService.Add(donor);
//StateHasChanged();
donor.Id = Guid.NewGuid().ToString();
donor.DateModified = DateTime.UtcNow;
_db.Donors.Add(donor);
await _db.SaveChangesAsync();
base.StateHasChanged();
}
}
I put breakpoints to check if the model is being populated, and it is. The data is just not updating to database. No errors whatsoever.

how to have vuejs set to checked the correct radio button

I have a set of radio buttons and want to set the correct choice. I have a value financing.is_reamortizable which should reflect whether the end user has this clicked. How could / should I bind this or check via computed property or other choice?
<div class='row both10'>
<div class='col-md-4 input-group'>
Reamortization Available:
</div>
<div class='col-md-3 input-group'>
Yes<input type='radio' name='financing[is_reamortizable]' value="true" v-bind:value="financing.is_reamortizable" />
</div>
<div class='col-md-3 input-group'>
No<input type='radio' name='financing[is_reamortizable]' value="false" />
</div>
</div>
The official documentation shows that you should set v-model on both radio buttons to the same variable (https://v2.vuejs.org/v2/guide/forms.html#Radio). You don't need v-bind:value in this instance because your values are static (true and false).
So your code would become:
<div class='row both10'>
<div class='col-md-4 input-group'>
Reamortization Available:
</div>
<div class='col-md-3 input-group'>
Yes<input type='radio' name='financing[is_reamortizable]' value="true" v-model="financing.is_reamortizable" />
</div>
<div class='col-md-3 input-group'>
No<input type='radio' name='financing[is_reamortizable]' value="false" v-model="financing.is_reamortizable"/>
</div>
</div>

how to add radio button in front end customer registration form and store it into database

kindly help me, how to add radion button in magento 1.9 in customer registration form and store it into database
<div class="field">
<div class="input-box">
<input type="radio" name="login_reference" value="customer_login" title="<?php echo $this->__('Customer Login') ?>" class="radio" checked />
<label for="login_reference"><?php echo $this->__('Customer Login') ?></label>
</div>
</div>
<div class="field">
<div class="input-box">
<input type="radio" name="login_reference" value="store_user_login" title="<?php echo $this->__('Store User Login') ?>" class="radio" />
<label for="login_reference"><?php echo $this->__('Store User Login') ?></label>
</div>
</div>
i just created like this.how to save that value into database...
You have overwrite customer controller and create one field in customer table as a login_reference .
you have to overwrite customer controller Accountcontroller.php file using below code in config.xml within Tag.
<routers>
<customer>
<args>
<modules>
<companyname_modulename before="Mage_Customer">New_Mage_Customer</companyname_modulename>
</modules>
</args>
</customer>
</routers>
after that you have to create a function createPostAction() and set your field value in it.you can pass 0 or 1 value for save login_reference field.

Can't access the Velocity ProjectManager in an admin configuration form for a JIRA plugin

I build an admin configuration form for an existing JIRA plugin based on Atlassian's own admin configuration form tutorial.
By now the template appears when clicking the configure button, except one problem: I can't access the Velocity ProjectManager class. When explicitly testing it by simply writing $projectManager into the Velocity template, the string itself appears on the website instead of being resolved as a variable. How can I resolve it as a variable?
Here are some shortened versions of the code files 'admin.vm' and 'atlassian-plugin.xml':
admin.vm
<html>
<head>
<title>$i18n.getText("com.example.jira.PluginConfiguration.head")</title>
<meta content="admin_plugins_menu/upm_section" name="admin.active.section">
<meta content="upm-admin-link" name="admin.active.tab">
<meta name="decorator" content="atl.admin">
<meta name="application-base-url" content="$applicationProperties.getBaseUrl()">
$webResourceManager.requireResource("com.example.jira:resources")
</head>
<body id="jira" class="page-type-admin ">
<form name="PluginConfigurationForm" action="/secure/PluginConfiguration.jspa" method="post" style="padding: 0; margin: 0;">
<input type="hidden" name="atl_token" value="${atl_token}" class="aui">
<div>
<h2 class="aui top-label">$i18n.getText('com.example.jira.PluginConfiguration.title')</h2>
</div>
<div class="hidden">
<input name="id" type="hidden" value="${action.id}"> <input
name="returnUrl" type="hidden" value="$!{action.returnUrl}">
</div>
$projectManager
<div class="buttons-container form-footer">
<div class="buttons">
<input accesskey="s" class="button" id="PluginConfiguration-submit"
name="PluginConfiguration" title="Press Ctrl+Alt+s to submit this form"
type="submit" value="$i18n.getText('com.example.jira.PluginConfiguration.input.button.save')">
<a accesskey="`" class="cancel" href="/plugins/servlet/upm"
id="PluginConfiguration-cancel" title="Press Ctrl+Alt+` to cancel">$i18n.getText('com.example.jira.PluginConfiguration.input.button.cancel')</a>
</div>
</div>
</form>
</body>
</html>
atlassian-plugin.xml
<atlassian-plugin key="${project.groupId}.${project.artifactId}"
name="${project.artifactId}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">img/Project_Logo.png</param>
<param name="plugin-logo">img/Project_Logo.png</param>
<param name="configure.url"><![CDATA[/plugins/servlet/ConfigurePlugin/admin]]></param>
</plugin-info>
<resource type="i18n" name="i18n_PluginConfiguration" location="com.example.jira/PluginConfiguration" />
<component-import key="pluginScheduler">
<description>SAL Scheduler</description>
<interface>com.atlassian.sal.api.scheduling.PluginScheduler
</interface>
</component-import>
<component-import key="pluginSettingsFactory"
interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" />
<component-import key="transactionTemplate"
interface="com.atlassian.sal.api.transaction.TransactionTemplate" />
<component-import key="userManager"
interface="com.atlassian.sal.api.user.UserManager" />
<component-import key="loginUriProvider"
interface="com.atlassian.sal.api.auth.LoginUriProvider" />
<component-import key="renderer"
interface="com.atlassian.templaterenderer.velocity.one.six.VelocityTemplateRenderer" />
<component-import key="applicationProperties"
interface="com.atlassian.sal.api.ApplicationProperties" />
<servlet key="admin-servlet"
class="${project.groupId}.PluginConfigurationServlet">
<url-pattern>/ConfigurePlugin/admin</url-pattern>
</servlet>
<rest key="rest"
path="/project-admin"
version="1.0">
<description>Provides REST resources for the admin UI.</description>
</rest>
<template-context-item key="applicationPropertiesContextItem"
component-ref="applicationProperties" context-key="applicationProperties"
name="Application Properties Context Item" />
<web-section key="ProjectAdminMenu" name="Project Admin Section"
location="admin_plugins_menu" weight="10">
<label>Project</label>
<description key="Project Administration Section"></description>
</web-section>
<web-item key="PluginConfiguration-web-item" name="Plugin Configuration Web Item"
i18n-name-key="com.example.jira.PluginConfiguration-web-item.name"
section="admin_plugins_menu/ProjectAdminMenu" weight="46">
<description i18n-name-key="PluginConfiguration-web-item.description"></description>
<label key="com.example.jira.PluginConfiguration-web-item.label" />
<link linkId="PluginConfiguration-web-item-link">/plugins/servlet/ConfigurePlugin/admin?decorator=admin/</link>
<tooltip>Configure the Project Jira Plugin</tooltip>
</web-item>
<web-resource name="PluginConfiguration Web Resource"
i18n-name-key="com.example.jira.PluginConfiguration-web-resource.name"
key="PluginConfiguration-web-resource">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<description i18n-name-key="PluginConfiguration-web-resource.description"></description>
<context>jira.admin</context>
<transformation extension="js">
<transformer key="jsI18n" />
</transformation>
<resource type="download" name="PluginConfiguration.js"
location="javascript/PluginConfiguration.js">
<property key="content-type" value="text/javascript" />
</resource>
</web-resource>
</atlassian-plugin>

Struts 1 Nested tags: getting unexpected html

I am working on an old application using Struts 1. We are using nested tags. For below code:
<nested:form action="/save.do?method=save">
<h2>Indexed Property Example</h2>
<nested:iterate property="lines" indexId="idx">
Name: <nested:text property="name" indexed="true"/>
Town: <nested:text property="town" indexed="true"/>
<nested:iterate property="inches" indexId="j">
Inch: <nested:text property="length" indexed="true"></nested:text>
</nested:iterate>
</nested:iterate>
<nested:submit value="save" />
</nested:form>
I am getting below html:
<h2>Indexed Property Example</h2>
Name: <input name="nestedForm[0].lines[0].name" value="" type="text">
Town: <input name="nestedForm[0].lines[0].town" value="" type="text">
Inch: <input name="nestedForm[0].lines[0].inches[0].length" value="0" type="text">
Inch: <input name="nestedForm[1].lines[0].inches[1].length" value="0" type="text">
<input name="" value="save" type="submit">
If you see in second Inch label we have nestedForm[1] it should be 0. I have to change to this data and submit back to server. If I change it directly in html struts populate all objects automatically. Can anyone suggest me if I am doing anything wrong here.