Need some help again!
I have seen many tutorials but they couldn`t help me.Then I decided to ask.
I`m using cakephp 2.5.5
I have this relationship:
Vendor has_many EventVendor
EventVendor belongs_to Vendor
in View\EventVendors\edit.ctp I have this form:
<?php
echo $this->Form->input('id');
echo $this->Form->input('vendor_id');
echo $this->Form->input('description');
echo $this->Form->input('quantity');
... more code
?>
This line:
echo $this->Form->input('vendor_id');
Is a selectbox that cakephp creates, but I need it to be an input(type text) where user will be able to type the vendor`s name and jquery autocomplete will complete automatically(autocomplete is working fine in other inputs).
The problem is: vendor_id is a foreign_key, because that I need to store the vendor's 'Id' instead of the vendors 'name'.
How can I do that?
I think you need someting like select2. Your field vendor_id should still be a list (like cake automatically baked). If you put select2 on it (see the examples) the user is able to type its choice.
Related
I have an online form with a custom html. If I make the field mandatory using the UI in the custom record the html for that field is no longer used and is replaced by the default Netsuite one. For example: On my html the label is on top of the field:
Enter Your Name
field goes here
When I make the field mandatory I know get this:
Enter your Name field goes here
No matter what I do with the css I cannot seem to get it to do what the other fields do.
Any ideas on how I can overcome this?
I have built a website (with MODX) where some products are managed and displayed via the articles addon. The products should have a custom ordering but I don't know how to use a template variable for that.
If I enter the name of the TV in the "Sort Field" field nothing is shown at all.
So is it somehow possible to use a TV there?
Or is there another way to achive a custom ordering (note that I need the summary and date fields, so I cant't abuse them for that)?
You can do this by using getResource package. Look at sorbyTV, sortdirTV, sortbyTVType parameters in manual:
http://rtfm.modx.com/extras/revo/getresources#getResources-SelectionProperties
A Name Text Box is bounded to a Names field in the related Notes form.
How to make the values in the textbox into be converted automatically to CANONICALIZE when XPage is saved?
I have tried the following but they all failed.
A) Saving the form using currentDocument.save()
B) Use simple action "Save Document"
C) add #Name([CANONICALIZE], #ThisValue) in the associated Notes form field under input validation, input translation and even as computed field.
The OpenNTF Domino API has an openntfNABNamePicker dataProvider that you can use on a Name Picker control which provides this functionality. It has a returnNameFormat property to allow you to define whether the name should be stored in Abbreviated, Common or Canonical.
It may be possible to use a Converter as well, so that the name is converted to and from canonical format between browser and server.
Try
document1.replaceItemValue("yourField", #Name("[CANONICALIZE]",document1.yourField));
in the querySaveDocument event of your xpage,
where document1:
<xp:this.data>
<xp:dominoDocument var="document1" ... />
</xp:this.data>
You can also use the following code in your save-script:
var name:NotesName = session.createName(getComponent("inputText1").value)
document1.replaceItemValue("NameNA", name.getCanonical())
document1.save()
NameNA is your notes field of type "names" and "document1" is your datasource.
The canonicalize needs something to work with. "John Doe" doesn't turn magically into "CN=John Doe/OU=ThePitt/O=GI"
Without a directory to find the name only something like "John Doe/ThePitt/GI" would canonicalize properly.
You could use #NameInfo to check if you can get the fullname back from a directory.
The conversion is easy and no coding is involved using the OpenNTF Domino API.
I found myself looking for ways to resolve the issue above myself in my project, while Paul provided the answer, it took me a while to really understand how to go about it.
I'm adding an image below just to help anyone that may find themselves in a similar situation. It shows where to go to change the valueNameFormat property
I have created a custom CCK field and gave proper permission to users, but
for some reason I cannot access the field by using
$node->field_name
does anybody have Idea about this ?
Thanks In advance
-S
print_r($node->field_machine_readable_name) and see what it prints. You can use the devel module to see deep information about various fields and functions.
I found that for some reason, in drupal 6 if we are using same CCK field for different content types, Nodes that had already created may not have the newly created field. When you edit and save the node. you will get the value for the new field.
How to implement Attribute to find his own name in the admin area in Opencart : Products - Attributes - Attributes? Is that there is a separate field and simply by driving into the field and displays the name of the attribute is an attribute, as usual searching for items in the admin by name, but only with attribute
It's hard to understand what you are asking, but if you are trying to use attributes for products then you must first define them at catalog>attributes>attributes.
To List attributes in the Products tab you will need edit these files
admin>view>template>catalog>product_form.tpl
admin>controller>catalog>product.php
If your understanding of PHP or Opencart isn't very strong it will help you to copy data from the attribute.php controller to the product.php controller.
As for the search function, this is something I haven't done before but you could try using the search function on the front of the website as reference.
I recommend working through this as best you can then asking more questions if or when you get stuck.
*Update
Ok so since HTML is your strenth it will be smartest to start from there. Open any of these files (the ones that have the data you need).
admin>view>template>catalog>attribute_form.tpl
admin>view>template>catalog>attribute_group_form.tpl
admin>view>template>catalog>attribute_group_list.tpl
admin>view>template>catalog>attribute_list.tpl
Then work backwards with what you see. The tpl will show variables that look like $attribute, track these back to
admin>controller>catalog>attribute.php
admin>controller>catalog>attribute_group.php
And you will see how all the code is used to pull the data from the model and format it if necessary.