phonerecord table
-----------------
phonecallID
...
[whocompany] -> clients.clientID
[staffanswered] -> staff.staffID
clients table
-------------
clientID
clientname
staff table
-----------
staffID
staffname
create new record
list new record
As you can see in the images after adding a new record then go to View page, two combo boxes are not selected. Their state after saving the new record is not carried over to View page.
<h:column>
<f:facet name="header">
<h:outputText value="#{bundle.ListPhonerecordTitle_whocompany}"/>
</f:facet>
<h:selectOneMenu id="whocompany" value="#{phonerecordController.selected.whocompany}" title="#{bundle.EditPhonerecordTitle_whocompany}" >
<f:selectItems value="#{clientsController.itemsAvailableSelectOne}"/>
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{bundle.ListPhonerecordTitle_staffanswered}"/>
</f:facet>
<h:selectOneMenu id="staffanswered" value="#{phonerecordController.selected.staffanswered}" title="#{bundle.EditPhonerecordTitle_staffanswered}" >
<f:selectItems value="#{staffController.itemsAvailableSelectOne}"/>
</h:selectOneMenu>
</h:column>
I think i need to modify controller class(s).
fixed it
<f:facet name="header">
<h:outputText value="#{bundle.ListPhonerecordTitle_whocompany}"/>
</f:facet>
<h:outputText value="#{item.whocompany.clientname}"/>
Related
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>
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.
I have multiple html helpers. When I click login button I am disabling user_register div using jquery and when I enter details the username and password the model binder is able to bind properly but when I click Register I am disabling user_login div and enabling user_register div and when I enter the details only email and firstname is what the model binder is able to bind and not username, password. Is this becoz I am using the same html helpers more than once. How to handle this. I have the following code
<div class="user_login">
<label>Email / Username</label>
#Html.TextBoxFor(model => model.Email)
<br />
<label>Password</label>
#Html.TextBoxFor(model => model.Password)
<br />
<div class="action_btns">
<div class="one_half"><i class="fa fa-angle-double-left"></i>Back
</div>
<div class="one_half last">
<input type="submit" style="border: none" name="action" class="btn btn_red" value="Login" />
</div>
</div>
Forgot password?
</div>
<div class="user_register">
<label>Full Name</label>
#Html.TextBoxFor(model => model.First_Name)<br />
<label>Email Address</label>
#Html.TextBox(model=>model.Email)<br />
<label>User Name</label>
#Html.TextBoxFor(model => model.User_Name)<br />
<label>Password</label>
#Html.TextBox(model=>model.Password") <br />
</div>
The controller follows here
public ActionResult Index(Customer customer, string Action)
{
//something here
}
You have not shown you complete view, but assuming all those controls are generated inside one form element, then all controls will post back unless you make the inputs disabled. If so, then the first input with name="Email" is bound and the second one is ignored by the DefaultModelBinder. (since the first one is only hidden, its value is probably empty). Your script needs to ensure that the 2 inputs in the login section are disabled, for example
#Html.TextBoxFor(model => model.Email, new { id = "login-email" })
and
$('#login-email').prop('disabled', true);
Note the id attribute so you can select the correct one (and prevent duplicate id's which is invalid html.
An alternative would be to create 2 separate forms.
I have a few lines of code in which no server connection and databse fetching included. Problem is picture is not being displayed when I want to show that in datalist.
<asp:DataList ID="dlpic" runat="server" RepeatDirection="Horizontal" RepeatColumns = "4">
<ItemTemplate>
<div class="item" id="construction">
<div class="border">
<a id="imageLink" href="~/images/Gallery/Gallery_Halmar001.jpg" class="zoom prettyPhoto" runat="server" >
<img src="images/Gallery/Gallery_Halmar001.jpg" class="scale-with-grid" />
</a>
</div>
<h5></h5>
<p></p>
<div class="shadow"></div>
</div>
</ItemTemplate>
</asp:DataList>
Do I still need to bind datalist?
Yes you need to bind it. A datalist will not render any items if it is unbound or bound to a List with 0 items. But if you're not binding to anything, why use the datalist at all? Just display the markup directly.
I am just starting out using ORM and I'm running into confusion.
Here is my error:
Error Occurred While Processing Request
Repeated column in mapping for entity: skill column: programTypeID (should be mapped with insert="false" update="false")
Here is a basic scenario I am using:
TABLES:
**ProgramType**
programTypeID (PK)
programType varchar(50)
**Skill**
skillID (PK)
Skill varchar(50)
programTypeID(int) (FK)
From my understanding my skill - programtype relationship is a many-to-one... Meaning Many Skills can only have 1 program Type... or 1 program type can be mapped to many skills.
Skill.cfc:
<cfcomponent persistent="true">
<cfproperty name="skillid" fieldType="id" generator="identity">
<cfproperty name="skill" ormType="string">
<cfproperty name="programTypeID" ormType="integer">
<cfproperty name="programType" fieldtype="many-to-one" fkcolumn="programTypeID" cfc="programType">
</cfcomponent>
ProgramType.cfc
<cfcomponent persistent="true" table="programtype">
<cfproperty name="programtypeid" fieldType="id" generator="identity">
<cfproperty name="programtype" ormType="string">
<cfproperty name="skill" fieldType="one-to-many" type="array" cfc="skill" fkcolumn="programTypeID" inverse="true">
</cfcomponent>
SkillEditForm.cfm
<cfoutput>
<form class="form-horizontal" action="submit.cfm" method="post">
<input name="skillid" type="hidden" value="#skill.getSkillid()#">
<div class="control-group">
<label class="control-label" for="programTypeID">Skill</label>
:
<div class="controls">
<select name="programTypeID">
<cfloop index="programType" array="#programTypes#">
<option value="#programType.getProgramTypeID()#"
<cfif programType.getProgramtypeid() eq skillProgramType.getProgramTypeid()>selected</cfif>
>#programType.getProgramType()#</option>
</cfloop>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="skill">Skill</label>
:
<div class="controls">
<input type="text" id="skill" placeholder="" name="skill" value="#skill.getSkill()#">
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Submit</button>
</div>
</div>
</form>
</cfoutput>
I find that if I remove programTypeID from the skill.cfc my error goes away. But, my confusion runs in, if programTYpeID is not defined in my CFC, when I go to add or update my entity on the submit.cfc page... how will I set the programTypeID from my select box on the form?
You need to remove the programTypeId property, otherwise you will have 2 columns with that name as the relationship you define will create one.
You would first need to grab the program type that matches the ID passed in and then set that value in the Skill object such as (this assumes you have already created a Skill object)
var programType = entityLoadByPK( 'programType', form.programTypeId)
skill.setProgramType( programType )
As part of validation, you would also want to make sure that the programType is not null before trying to save.