I am developing in odoo 8, and my task is to create menu links on left side of the page and when you click the link, the template having html should be shown. below are the codes applied so far:
my template is : external id ( menu_item.test )
<template id="receivePO">
<div >
<div align="center" >
<h2>Login</h2>
</div>
<form role="form" t-attf-action="" method="POST">
<div align="center">
<table >
<tr>
<td>Enter Name :</td>
<td><input type="text" name="username" id="po"/></td>
</tr>
<tr>
<td>Enter Password :</td>
<td><input type="text" name="passwd" id="po"/></td>
</tr>
<tr>
<td></td>
<td><button name="submit" type="submit" >Submit</button></td>
</tr>
</table>
</div>
</form>
</div>
</template>
The above template is in Module A.
I have created a new module ( Module B) to create menu item in warehouse menu and if clicked on the menu item login it should display the above template.
in Module B, the menu items are:
<record id="action_view_menu" model="ir.actions.act_window">
<field name="name">MenuItem</field>
<field name="res_model">Module B Model Name</field>
<field name="inherit_id" ref="menu_item.test" />
</record>
<menuitem id="menu_sub_sales_menuitem" parent="stock.menu_stock_root" name="Warehouse Management" sequence="1"/>
<menuitem id="menu__sub_menuitem" parent="menu_sub_sales_menuitem" name="Processes" sequence="1" groups="base.group_no_one" />
<menuitem id="menu__menuitem" parent="menu__sub_menuitem" name="Login" sequence="1" action="action_view_menu" />
I have tried using using ir.ui.view in model also, but got errors.
Can someone help me regarding this. Also, Login template in other Module will be processing login and going into other templates. I have to show those templates on click of the submit button.
Thanks,
Related
In a facebook-esque fasion, I'm working in a post with comments. The comments have a int which indicates the id of the parent post. So Comment 1 and 2 both have assigned as parent Post 1.
What im working on is on displaying them as a grid within a grid. Here is that part in .zul:
<grid id="postGrid" height="550px" model="#load(vm.pcdata.posts)" emptyMessage="No Posts.">
<template name="model">
<row>
<window border="normal">
<!-- .................. -->
<!-- PARENT POST -->
<!-- .................. -->
<caption id="userPost" label="#load(each.user)"/>
<textbox id="infoPost" readonly="true" value="#load(each.info)" multiline="true" rows="4" width="100%" mold="rounded"/>
<separator bar="true"/>
<hlayout>
<div>
<button label="Like" onClick="#command('addPLike', postid=each.postid)"/>
</div>
<div hflex="true">
<textbox id="likeTB" disabled="true" width="40px" style="text-align:center" value="#load(each.plikes)"/>
</div>
</hlayout>
<separator bar="false"/>
<window border="normal">
<!-- .................. -->
<!-- THE SECOND GRID-->
<!-- .................. -->
<grid id="commentGrid" height="150px" model="#load(vm.pcdata.comments)" emptyMessage="No Comments.">
<template name="model">
<row>
<window border="normal">
<caption id="userComment" label="#load(each.user)"/>
<textbox id="infoComment" readonly="true" value="#load(each.info)" multiline="true" rows="4" width="100%" mold="rounded"/>
<separator bar="true"/>
<hlayout>
<div>
<button label="Like" onClick="#command('addCLike', commentid=each.commentid)"/>
</div>
<div hflex="true">
<textbox id="likeTB" disabled="true" width="40px" style="text-align:center" value="#load(each.clikes)"/>
</div>
</hlayout></window></row></template></grid></window></window></row></template></grid>
In the second grid, I imagine there could be some sort of if function in which if both the postid in the father Post and the postsrc in the child Comment are the same, the comment will be displayed. Is there any way to make this work?
You can use shadow element <if>, e.g.
<if test="#load(vm.yourFlag)">
<grid id="commentGrid">
....
</if>
please see http://books.zkoss.org/zk-mvvm-book/8.0/shadow_elements/flow_control.html
Do you mean commentGrid is created but inner window is hidden, so there is space inside commentGrid, right?
Since you specify emptyMessage on commentGrid, it should show no comments. Or there are still comments but all hidden? If so, you can consider hide both commentGrid with inner window.
I am trying to pass a form input to an external URL to be used somewhere else and perform a certain task. The issue I am having is actually getting the value and passing it. I either get a LotNumber is undefined or an error executing a Cfquery. I tried using CFPARAMhowever I think I misunderstand what cfparam does. Hopefully this is something simple.
Here is some code:
<table border="1" cellpadding="3" cellspacing="0" rules="GROUPS" frame="BOX" width="100%" bordercolor="#C0C0C0" bgcolor="#FFFFFF">
<thead>
<tr height="28">
<td colspan="4"><b>Outstanding Shipping</b></td>
<CFOUTPUT>
<cfparam name="Show_SampleLogSheet.Passed_LotNumber" default="" />
<td align="left" colspan="1">
<input class="frm3" type="text" id="Outstanding_Passed_LotNumber" size="3" maxlength="6" tabindex="25" style="background-color: ##838383;border:1px solid ##000000; color:white">
<form name="Show_SampleLogSheet" class="frm" action="/Buying/Shipping_Advice/Index.cfm?Passed_CustomerID=#Passed_CustomerID#&Passed_ShippingAdviceID=#Get_ShippingAdvice.ShippingAdviceID#&Passed_Lot_Number=#Show_SampleLogSheet.Passed_LotNumber#&Passed_Activate=1" method="post" style="display: inline">
<input type="hidden" name="Passed_CustomerID" value="#Passed_CustomerID#">
<input class="frm3" type="text" name="Passed_LotNumber" value="#Show_SampleLogSheet.Passed_LotNumber#" size="3" maxlength="6" tabindex="25">
</form>
</td>
</CFOUTPUT>
I really appreciate any help.
Thank you
For names are client side. ColdFusion does not need to name them at all. (Code has been somewhat similified
<cfparam name="Passed_LotNumber" default="" />
I don't know what this field is good for. It is not within the form tag, so it is not going to get pushed over on submit.
<input class="frm3" type="text" id="Outstanding_Passed_LotNumber" size="3" maxlength="6" tabindex="25" style="background-color: ##838383;border:1px solid ##000000; color:white">
Real form starts here. Note that passed_LotNumber does not need anything
<form name="Show_SampleLogSheet" class="frm" action="/Buying/Shipping_Advice/Index.cfm?Passed_CustomerID=#Passed_CustomerID#&Passed_ShippingAdviceID=#Get_ShippingAdvice.ShippingAdviceID#&Passed_Lot_Number=#Passed_LotNumber#&Passed_Activate=1" method="post" style="display: inline">
<input type="hidden" name="Passed_CustomerID" value="#Passed_CustomerID#">
<input class="frm3" type="text" name="Passed_LotNumber" value="#Passed_LotNumber#" size="3" maxlength="6" tabindex="25">
Turns out it was some the wrong input name. Here is the fixed code:
<td align="left" colspan="1">
<input class="frm3" type="text" id="Outstanding_Passed_LotNumber" size="3" maxlength="6" tabindex="25" style="background-color: ##838383;border:1px solid ##000000; color:white">
<form name="Show_SampleLogSheet" class="frm" action="/Buying/Shipping_Advice/Index.cfm" method="post" style="display: inline">
<input type="hidden" name="Passed_CustomerID" value="#Passed_CustomerID#">
<input class="frm3" type="text" name="Passed_Lot_Number" size="3" maxlength="6" tabindex="25">
</form>
</td>
There was a parameter that was hidden somewhere else named Passed_Lot_Number instead of Passed_LotNumber. I apologize, this is some super crap code and it's super old thus all of these dumb headaches. Thank you everyone
I'm updating a query using a form and ajax.
I added a new column (select option) to the form, it work before adding the select option.
I'm trying to get the value of the #dept_id# but i keep getting error
'NetworkError: 500 Error Executing Database Query'.
This has to do with the update query I have in delete_record.cfc.
when adding dept=#selectDept# to the query is when i get the error.
Taking this part off the query works and it updates.
Below its the form and after that its the delete_record.cfc file.
I also made a http://jsfiddle.net/6focvy54/4/
where I poster the ajax call and have the delete_record.cfc file code.
<form method="post" action="" id="confrm_key">
<table >
<tr>
<th >Add?</th>
<th >Delete?</th>
</tr>
<cfoutput query="total">
<tr id="hd#emp_id#">
<td>
<select name="selectDept" >
<option selected="selected" >Select Department</option>
<cfloop query="department">
<option value="#dept_id#">#dept_name#</option>
</cfloop>
</select>
</td>
<td> <input type="checkbox" name="check_delete" value="#emp_id#" >Yes</td>
</tr>
</cfoutput>
</table>
<p><input type="button" name="Submit" value="Remove" onclick="sub_keys();"></p>
</form>
I want my code to do this...
<c:if test="${validated != 'Y' }">
<form:form id="newJob" method="post" action="updateValidated" commandName="jobModel">
<form:input path="regattaId" type="hidden" />
<form:input path="job_id" type="hidden" />
<table>
<tr>
<td><spring:message code="label.validated" />
<td><form:radiobutton path="validated" value="Y" />Yes<form:radiobutton
path="validated" value="N" />No</td>
</tr>
</table>
<input type="submit" class="button" value='<spring:message code="label.validateJob"/>' hidden="true" />
</form:form>
</c:if>
<c:else>
This job is validated
</c:else>
Any takers? Right now it doesn't work.
I think my syntax is correct but I'm very new
<c:else> doesn't exist, and has never existed. Read the documentation of what you're using instead of trying random things.
The correct way, using the JSTL, to have the equivalent of if/else is
<c:choose>
<c:when test="condition">...</c:when>
<c:otherwise>...</c:otherwise>
</c:choose>
the equivalent code is
<c:choose>
<c:when test="${validated != 'Y' }">
<form:form id="newJob" method="post" action="updateValidated"
commandName="jobModel">
<form:input path="regattaId" type="hidden" />
<form:input path="job_id" type="hidden" />
<table>
<tr>
<td><spring:message code="label.validated" />
<td><form:radiobutton path="validated" value="Y" />Yes<form:radiobutton
path="validated" value="N" />No</td>
</tr>
</table>
<input type="submit" class="button"
value='<spring:message code="label.validateJob"/>' hidden="true" />
</form:form>
</c:when>
<c:otherwise>
This job is validated
</c:otherwise>
</c:choose>
Jstl's c:if tag doesn't have a companion c:else tag. Try c:choose!
I am trying to re-using templates over multiple domains.
Template looks like this:
<div id="emailEntry">
<Table>
<tr class="prop">
<td valign="top" class="name">
<label for="email" id="email"><g:message code="default.email.label" default="Primary e-mail address* :" id="email" /></label>
</td>
<td valign="top" class="value ${hasErrors(bean: instanceToUse, field: 'email', 'errors')}">
<g:textField name="email" value="${instanceToUse?.email}"/>
</td>
</tr>
</Table>
</div>
and my view calls this template like this:
<g:render template="/templates/frmEmailTableEntry" />
Both of my class "customer" and "employee" have email attributes.
so my question is, if I want to reuse template "frmEmailTableEntry" for class "customer" and "employee", what should I put to "instanceToUse" in template.
I read about rendering with var declared, but I am not so sure how to pass this. Please help me with this.
Thanks in advance.
It doesn't really matter what you put in the template. If you leave it just as is you could use it in other gsp's like this:
//say the instance you wish to use is "customerInstance"
<g:render template="/templates/frmEmailTableEntry" model="[instanceToUse: customerInstance]" />
That passes the customerInstance into the ${instanceToUse} variable in the template.