Many websites use <input type='text'> element to get simple text data from their customers. You can configure your browser to remember the values you enter into these fields, so that it can suggest you back a list of values, to speed up your data entry experience.
However, I'm seeing a strange behavior. On some fields of the same type, browser doesn't suggest anything, or suggests a different list from other fields. I've checked all fields and all of them are of the same <input type='text'> type.
Does anybody know how browser differentiates between different lists (or no list) for the same HTML form control?
There's an attribute on form elements that allows them to semantically specify their intended content (I believe its the V_Card attribute).
The following page gives a brief explanation and a table of acceptable values:
http://microformats.org/wiki/hcard-input-formats
Related
How to get visible attributes from entity form using c# in custom workflow?
Any idea please share!
It's a PITA but it's doable.
retrieve the form you want to process from the systemform entity (you want the formxml attribute)
the formxml attribute contains the form definition, it's encoded (< is written as < and so on) xml format.
Inside the formxml contents, a field looks like this:
<cell id="(guid)" labelid="(guid)" showlabel="true" locklevel="0" visible="false">
<labels>
<label description="(field label)" languagecode="1033" />
</labels>
<control id="(field name)" classid="(guid)" datafieldname="(field name)" disabled="false">
parse the xml, looking for cell elements which do not have visible attribute (it's only there if the field is hidden)
you might have to narrow the list down through further searches in xml (not 100% positive about what i.e. a subgrid would look like) but I have no direct experience with this kind of logic so I can't pinpoint each and every corner case
Pain point: You won't be able to tell if a field visibility has been toggled through javascript
What do you mean visible attributes? You mean attributes with a value or attributes showed in the form? If it's the second the only way that you have to keep track of that is use a text field and use some code to identify what is active.
ex. create a text field
and write in it all the fields that are visible ex name and surname:
"name","surname"
You can manipulate this with javascript and business rules to keep the list of fields updated at every time for each record. In the code behind you just need to read for the text field and manipulate the magic string.
It's not a really nice operation, but is the only way i can see to keep track of what fields are shown on the form.
Are Wizards & Transient Models the right way to implement complex interactive search across several tables (objects) and to visualize data aggregated from several objects?
“Complex interactive search” means a search panel with several input fields for entering search criteria, where input fields are dynamically filtered according to user access rules and data from other fields.
“Across several tables” means data stored in different objects (osv.Model) -- i.e. not only in different tables, but in different python 'objects' (osv.Model).
My current implementation using wizards & transients has the following drawbacks:
no way of filtering / grouping search results. Search results are handled as a one2many field, displayed as a Tree view in the Form view of the parent search wizard ==> hence no way of grouping results inside a form view of a wizard. Frankly, I’d be happy if there would be a way of making a complex search over multiple objects from a Tree view, as we do it with simple search on a single object.
2 reloads of a page happen when changing input parameters and making another search. First, the page is refreshed with the old results inside, and then after a second or two (w/o showing “Loading…”) the page is refreshed with the new results appearing. This doesn’t happen if I search with the same parameters several times in a row -- then only 1 refresh happens. This double refresh is very user-unfriendly, as it creates an impression that the search failed (the old results are displayed). Probably, this happens because on every search I create a new wizard instance (to keep a search history before it’s cleared with autovacuum) and return its id as a 'res_id'. However, I create a copy of previous wizard by passing an empty list as default search results ids, so I wouldn’t expect the old-results to show up. Also, I wouldn’t expect the second refresh to happen.
results from all previous searches are preserved on the client side and just made hidden on the page instead of being removed completely from the page ===> makes the page heavy after a lot of searches. E.g.:
<div class="oe_view_manager oe_view_manager_inline" style="display: none;">
<div class="oe_view_manager oe_view_manager_inline" style="display: none;">
<div class="oe_view_manager oe_view_manager_inline" style="display: none;">
<div class="oe_view_manager oe_view_manager_inline">
Here: 3 old result sets + the current active one (visible). Think I can get rid of those old results using JavaScript. Still, I wonder what is the purpose of such preserve&hide behavior?
I have, what I think is, a simple feature that I am trying to add to my Orchard (1.6) site, but I can't find any tutorials or instructions on how to do it. I have a custom type called "Office" and each office has a custom field called "State" indicating which state the office is in. I actually designed my Offices as a custom part in code with specific properties such as State on it, but I "think" it's the same as if I added the State through the Admin interface as a field on the Office content part.
Now, I can create a basic projection to show all the offices with a simple filter of "Content with type Office" to display all offices. However, what I want to do now is to have a drop down list at the top of the page that says "Filter by: [-SELECT STATE-]" with a list of all 50 states. When the user selects a state, the page should refresh and display just the offices in that state.
This is where I'm stuck. Should I do this through the code, or can I do this through the Admin UI? If through the code, should I model it after the Orchard.Search module (which I tried to do, but I am completely lost). If I can do it through the UI, do I use projections? If so, do I have to create 50 separate projections (one for each state)? That seems extremely time consuming to create and maintain.
Any help is GREATLY appreciated!
FYI, the site at http://ktowneric.com/listings/search (which uses Orchard) is very similar what I am looking for, and the developer stated he used projections, but I can't seem to figure out how he did it.
You can definitely use a projection. If you notice when you use the search function on the page you referenced, the inputs are formed into query string values. You can use tokens to grab the values from query strings to use in your projection filter. For example, if you're using fields as you stated, then you just add a filter for that field and in the value field use {Request.QueryString:State}. Or, replace "State" with whatever key you're using for the query string value.
That solves your projection issue. You will need to build a search form that would look something like this...
<form action="/search-results" method="Get">
<select name="State">
<option value="OH">Ohio</option>
...all the states...
</select>
<input type="submit" value="Search" />
</form>
"/search-results" could be a projection page or any content that has the projection widget present. You could build the form as a widget that you can place somewhere, or for testing purposes, you could just paste this html into an html widget to try it out.
I have a SharePoint list that has MANY columns in it. The default AddForm and EditForm rendering is very cumbersome for the users. Most of these fields hold simple Number (integer) values. The default rendering for those two forms (using the ListFieldIterator I suppose) render the columns one by one vertically down the page. My thought was to design an input form with three basic "zones" (left/middle/right) and use a Custom Field for all of these "Number" fields. The Custom Field would contain two custom variable properties "Zone" and "Order". (Zone could contain middle/right and order would be the "order" in that zone the field would appear, the "left" zone would be for the fields that are not these "Number" fields, things like Date, Customer, etc. etc.) I would design the page with an HTML table and 6 Columns (1 for the "label" and one for the "TextBox" for each of the three "zones"). Then I could put a control (something similar to the "ListFieldIterator"). The control in the first zone would render the "static" fields, the zones in the other two zones would render the appropriate Custom Fields (based on the Custom Variable Property "Zone" and "Order").
Does this make sense? For the life of me, I can't figure out how to do this. I had thought about "giving up" and just using my ASP .Net skillset and creating FormViews and GridViews bound to the proper (ListView) DataSources. That has even proved challenging.
Does anyone have any ideas on how I could accomplish this? (InfoPath isn't an option and I want to stay with the "Custom Field" idea so the fields aren't laid out statically and can be moved around or even new ones added by the "administrator" of the Application (SharePoint List).
Any guidance is MUCH appreciated. I have been working on this all week and just seem "stuck".
Thanks,
Shayne
------ A Better explanation of my "application" and what I want to do-----
I have a SharePoint List that has about 60 fields in it. If I pushed this application out using the default Add/Edit SharePoint List Forms (and Rendering Templates), the users would hate it. The default forms use a rendering template that basically lays out all the list fields, one per (HTML) Row. Within that Row there are two (HTML) columns. The first one contains the "Label" for the field, and the second (HTML) column is the actual editor for the "FormField" (Text Box or whatever). Because of the number of fields in the list, the user would have to scroll several pages just to get to the bottom.
This list has about 10 "static fields" that I want to lay out on the left side of the page and then about 50 that are simply "task" fields. These store an integer and track "how many of these tasks did I do today". (This is a "port" of an MS Access application.) Depending on the "Add" page the user selects (I have a "parent" content type that contains every field and then a "child" content type for each "group" of users that will be using this form that contains just the fields/tasks that group tracks) the proper fields are rendered on the page. The problem is they are all rendered vertically and there is too much scrolling. These users (and admins) will NOT have access to SharePoint Designer or InfoPath. So, the "layout" for these fields must be iterator/repeater style (the users shouldn't have to get Development involved just to add a new "task" field to their application!).
The solution I had come up with is to use a Custom Field Type with two Custom Property Variables for each of these "task" fields. The Custom Property Variables (Zone and Order) would allow the administrators of the "application" to control where they want these fields to appear on the Add and Edit forms. The Zone Property can contain one of two values: "1st Task Column" (middle of the form) or "2nd Task Column" (right part of the form). (The "left" column of the forms would be used for those 10 or so "static" fields that all groups/depts/content types share.)The Order would just contain the order to sort the fields in, within their "zone". Obviously, the "zone" would indicate where on the form the field would appear (middle or right). I thought I might be able to use three Divs and render the appropriate List Columns in the appropriate DIVS. Or, following the default rendering template, instad of DIVs I could possibly use 6 (HTML) Columns instead of 2.
I quickly figured out how to make a new Field Type with Custom Properties (I used the Property Schema element in the XML definition, even though Microsoft says NOT to use that in SharePoint 2010, it was just so easy and I couldn't figure out how to add them otherwise. Now I know how to add them the "right" way, I just don't know if it is worth changing them.)
For the last few days, I have tried to figure out how to actually render these "zones". Remember, I want the users of this application to be able to add new fields dynamically, so I can't put any static field references in these forms. I have read about the Rendering Templates and the ListFieldIterator (and the new Content Iterator), but I can't seem to pull it all together and create an actual solution. The part that is throwing me off is how to query and render three different "sets" of fields at once (since the rendering is going to happen from "top to bottom").
Any help is very much appreciated!
Shayne
If InfoPath it out and you want to stay within the SharePoint infrastructure for forms, then the term you need to search for is DataFormWebPart. You may have heard of DataViewWebPart before, well this is the form equivalent. Just like the DVWP, this does lots and lots of XSLT to make its magic happen.
The trick is can you implement your grid/zone idea within the context of the DFWP's XSL. That I can't tell you but hopefully this is a starting point.
Defiantly Info Path is the solution here are some tutorials:
Video: http://channel9.msdn.com/blogs/laurhar/infopath-2010-customize-a-sharepoint-list-form
http://p2p.wrox.com/content/articles/customizing-sharepoint-2010-list-forms-infopath-2010
http://blog.libinuko.com/2010/03/21/sharepoint-2010-howto-start-customize-list-form-neweditview-using-infopath-designer-2010/
if you don't want to use InfoPath I would recomment JavaScript/jQuery you have just to modify (Edit) the page then inject some jQuery code to do what you want. Here are some articles about similar topics:
http://akanoongo.blogspot.com/2008/04/how-to-hide-fields-in-sharepoint-list.html
http://spground0.blogspot.com/2011/03/sharepoint-2010-custom-list-form-issues.html
http://ghamson.wordpress.com/2011/01/19/using-jquery-to-attach-regular-expression-validation-to-a-sharepoint-list-form-field-sp2010-ps2010-projectserver-in/
The only way you can achieve this type of custom form designing within the SharePoint framework is to apply it through post-rendering techniques using client-side code. And solutions like this tend to add considerably to page-load.
Simply changing the render template is not enough if you want it to be a dynamic and codeless experience for end users to author.
I can think of only one solution which comes close to fitting all criteria. It's "free", can be password protected, and also allows tab groups, rules and many other settings.
Dynamic Forms For SharePoint - http://spjsblog.com/dffs
I would like to add a field to a list with displays an Image, but acts as a hyperlink. In other words like the "Hyperlink or Picture" column, but "Hyperlink AND Picture" instead.
Where the two fields you input would be the URL to the image to display, and the URL of the hyperlink.
This must be possible. I notice that the Type (in a document library) column does just that, and also includes the views that are currently being used (in the case of a folder).
Is it possible to duplicate the computed Type field in a document library to read two other fields in the list (which will act as the image url, and the redirect link)? What would the CAML be?
Thanks in advance if anyone could offer any insight.
Arnhem
This can be done but you would need to develop a custom field type. As you have found, SharePoint's default rendering for pictures is without the hyperlink. You need to change how the rendering behaves in Display mode in your own custom field. Check Patterns in Custom Field Rendering for more info.
There are also several examples of creating custom field types on the web. The MSDN articles give a lot of detail about how it all works but don't let that put you off as it's not too tricky.