Dynamic controls in PDF Adobe Cycle - forms

Does anyone know how to add control (example: field) on-run in PDF? I'm using Adobe LiveCycle ES2; need that piece of JavaScript....
Thank you all -

I previously tried to do something similar but have never been able to find a method of dynamically creating an object on a form.
You can use the addInstance command to add an instance of a new form and it's possible to add additional rows to a table but other than that, the only method I have found that works is to add the objects from the toolbox and then show/hide them.
It does mean that you're adding additional objects to the form but if used correctly this doesn't really have too much affect on the file size but it does involve extra coding.

Related

Typo3 custom content element with content colPos

as I'm turning back to the real core functions of typo3 (which I used last before templatevoila), I wonder how I can create an content Element which acts like a container, where I can place content inside with the wizard.
As I got really enough from the flux-fluid update chaos, I think best solution ist to bet on the core functions.
I know, I can do this also with ext B13 container, but if it's possible somehow, I won't use any extensions as I can do it hopefully with core functions.
there is no container functionality inside TYPO3 core itself. I suggest using the b13 container extension which is well maintained and doesn't add much overhead.
First it depends what kind of container you want to realize.
If you don't really want to pack/wrap the contained CEs you can use the CE 'Records' which enables an editor to show multiple records from different positions in one place.
In the default rendering those records are rendered each without further wrapping.
Of course you can change the default rendering. but that would be an extension (except you do it by typoscript or templates below of fileadmin/), at least the site extension.
drawback:
no preview in page BE module
you need 'another' place to store the contained CEs, otherwise the CEs. would be shown twice (you could use another page, or another column (which does not get rendered)
You can vary the layout by evaluating the layout field of the records CE.
another solution with core oly:
add further 'layouts' so all ' contained' CEs get a special wrap which can be gathered with javascript into a container DOM object.

Is it possible to create your own drag and drop Mailchimp template?

I'd like to create a custom drag and drop template so I can increase the design possibilities without losing the functionality. I can't find anything in their documentation.
I was hoping to create something like this, not sure if I'm missing something obvious but I can't find a drag and drop that allows for the different coloured background with columns too.
I could use a block of code but I can't edit the css styles so it wouldn't be responsive for mobile and also not very friendly for those who don't know html.
Rather old question, but to who it might be helpfull:
If you code your own template and upload it to Mailchimp you lose the 'drag & drop' system/UX interface with the different blocks. You are able to create repeatable blocks but then it works with a dropdown list. This is (in my humble opinion) not that user friendly and takes a while before you fully understand how to use the dropdown. I had to explain it to a client earlier today and took a while before they understood it, so I decided to write them a manual for it.
But the design you want to create should be possible to make with a standard MC template. In the 'design' tab you will find settings to control background colors etc.
Still not possible, answer from the Mailchimp support: "At the moment, it's not currently possible to code a drag and drop template completely--one of our drag and drop template layouts will need to be selected, but you can drop in Code blocks to get a little more control over the styling of certain sections."
Though, if it's any help, it is possible to fully custom code your own template, and then add in mailchimps special Template language to the template to open up sections as editable within the campaign builder--or even duplicate certain sections of content. It's not quite the same as the drag drop templates, but adds similar functionality. More info on working with template language can be found here: https://mailchimp.com/help/getting-started-with-mailchimps-template-language/
I know this is an old question, but while searching for this myself I stumbled upon a solution posted here.
Basically it is possible to code your own drag n' drop template, but the solution has not been documented.
Find one of the Mailchimp templates (either one of the basic templates or a custom template from the 'Themes' menu.
Use 'Inspect element' and copy the source code of the iFramed html-email.
Paste in your preferred HTML-editor and modify as intended
Create your own template from the 'Paste in code' mode
If you want custom modules to be added by default, edit using the menu 'Edit design' in the bottom of the screen.
Save and exit :)
I found part of the answer on another topic: [Is it possible to code drag&drop templates for mailchimp?
If you add the following code into your main content div or td it will enable the drag and drop block editor:
mc:container="body_container" mccontainer="body_container"
example:
<div mc:container="body_container" mccontainer="body_container"></div>
This code will add a block editor region to the preheader section:
mc:container="preheader_container" mccontainer="preheader_container"
For the header:
mc:container="header_container" mccontainer="header_container"
For the footer:
mc:container="footer_container" mccontainer="footer_container"
Note: It doesn't seem to matter what you call the mc:container. Creating a new container with a different name worked. Although using just mc:container tag seems to work at first by itself, the mccontainer (no colon) tag is required for it to save properly.
You can create your own drag and drop template you need to add the following into your html coded template where you want the 'drag and drop' feature to exist.
<div id="templateBody" mc:container="container_name" mccontainer="container_name" class="tpl-container">
<div mc:block="3502204" mc:blocktype="text" mcblock="3502204" mcblocktype="text" class="tpl-block"></div>
</div>
This can be repeated in your code multiple times for multiple insertions. I could not find documentation to indicate if the container name or block number needs to be unique, I did make it unique in my template.

jQuery Show/Hide divs using same class not working because of html.push?

The object is to Show-Hide text located under their respective Titles, so a User reads the title and shows or hides text belonging to that title if the User wants to read more.
I tried whatever I could find so far on here, we're talking dynamically setting text coming from a spreadsheet, can't use IDs, must work with .class, must be missing something, I have this piece of code:
... html.push('<div class="comments">' + comment + '</div></div></div>');
but when I try this Show-Hide code nothing happens, even if the error console shows nothing. Basically I want to Show-Hide the .comments class divs with a show-hide toggle link located under each of them. I say them because the .comments divs are reproduced dynamically while extracting text coming from Google spreadsheet cells/row (one .comments div per spreadsheet row). I tried .next, child and parent but they all divorced me so I dunno looks like a dynamic issue. So far I only managed to globally toggle all divs to a visible or hidden state but I need to toggle independantly individual divs.
I prefer a jQuery solution but whatever worked so far was achieved with native javascript.
Note: If a cross-browser truncate function which would append a more-less link after a number of words (var) in each .comments divs would be easier to implement then I would gladly take that option. Thx for any help, remember I am still learning lol!
I have been working on an entirely JS UI project and have brought myself to using $('', { properties }).appendTo(BaseElement) to work best for adding HTML elements because it appropriately manipulates the DOM every time.
If you are having good luck with push elsewhere, however, breakpointing on the line where you do your $('.class').hide() and see what $('.class').length is. Alternately, you can just add alert($('.class').length) to your code if you are unable to breakpoint the code. If it is 0, then your elements have not been properly added to the DOM. Changing to append will ensure they are part of the DOM and therefore targetable via JQuery.

Creating reusable widgets

I`m using asp.net mvc 2.0 and trying to create reusable web site parts, that can be added at any page dynamically.
The problem I have is how to load a partial view with all related js and data? Ive tried the following ways to do that:
Use partial view and put all the js into it. In main view use render partial. But to initialize partial view I need to add model to current action method model to be able to make RenderPartial("MyPartialView", Model.PartialViewModel).
Also I do not have a place to put additional data I need to fill my form(like drop down lists values, some predefined values etc).
Use RenderAction, but it seems it have same problems as RenderPartial, except for I do not need to add anything to any other model.
Any other oprions are greatly appreciated.
As I understand it, RenderAction performs the full pipeline on the action, then renders the result - so what is rendered is the same as what you'd see if you'd browsed to the action.
I've used RenderAction to render 'widgets' throughout a site, but in my view they should be independent of the page rendering them, otherwise they're not really widgets and should be part of the rendering page's code instead. For instance, if there's a log in form, you will always take the user to a page that can process the information, no matter what page they are currently on, so this makes for a good widget. Other ways I've used it is to show a shopping basket or advertising. Neither of which are dependent on the page being shown.
Hope this helps a little!

ASP.NET MVC2 - Determine which type of template is being rendered

Instead of using DisplayFor and EditorFor, I would like to create a more generic ContentFor. In that Html extension it would take into account Metadata values to determine how to render the resulting control. The only piece of the puzzle I am not am to determine is this: Is there a way to determine if I am currently rendering a DisplayTemplate or an EditorTemplate. As a real-world example of this, when rendering a string, for the display version I would like to render it as a , but when rendering the editor version, I would want to render it as a text box.
To better explain, let's say I have two templates called Address.ascx, one in the DisplayTemplates directory and one in the EditorTemplates directory. I would like both of them to use ContentFor to render, but in the display version it renders as a label and in the editor version it renders as a textbox.
Using two ASCX files to call a single file control (which is doable, just do another RenderPartial or DisplayFor/LabelFor) doesn't make sense to me. It breaks the "seperation of concerns". Label displays labels, and Display displays values, it doesn't make sense for a control to try and figure out what way you want it to display.
If you want a use a custom display or label for a property, use the UIHint data Annotation.
[UIHint("MyCustomControlName")]
Then in the DisplayTemplates and EditorTempaltes create a "MyCustomControlName.ascx" file to display that property however you want. Additionally, the ascx controls can read custom Model Metadata and do whatever it is you need done. Example at http://weblogs.asp.net/seanmcalinden/archive/2010/06/11/custom-asp-net-mvc-2-modelmetadataprovider-for-using-custom-view-model-attributes.aspx.