Resolving Images for Input Buttons with SDL Tridion Compound Templates - tridion

I have the following sample code output from a Dreamweaver Template Building Block (DWT TBB) in SDL Tridion 2011:
<input type="image" src="tcm:33-1995" name="submit"/>
<img src="tcm:33-1995"/>
After the DWT TBB, we are using the Default Finish Actions in the Compound Component Template to resolve the paths etc. When I view this in Template Builder we see that the IMG tag is resolved SRC attribute, but the INPUT tag is ignored.
Is there a way to make the default TBBs resolve INPUT tags as well as IMG tags?

If I put the following in a DWT:
<input type="image" src="tcm:1-90" name="submit"/>
<img src="tcm:1-90" />
And then put that DWT in a Page Template like this:
DWT
Publish Binaries in Package
Resolve Links
I end up with this Output item in the end:
<input src="http://localhost/Preview/.../img.jpg" type="image" name="submit"/>
<img src="http://localhost/Preview/.../img.jpg" />
So how is your output different?
More info
After the DWT is executed, this is the Output item:
<input type="image" src="tcm:1-90" tridion:href="tcm:1-90"
tridion:type="Multimedia" tridion:targetattribute="src" name="submit"/>
<img src="tcm:1-90" tridion:href="tcm:1-90" tridion:type="Multimedia"
tridion:targetattribute="src" />
The Publish Binaries in Package TBB doesn't modify the Output item, so the Link Resolver changes this to the final Output I showed above.

In that case, you have to use below syntax to resolve the image url in input tag
<input type="image" src= "url(tcm:33-1995)" name="submit"/>
I hope it may works.

Related

How can i create a button in HTML

I tried writing this code. But when i change the location and modify the code it is showing file not found.
I tried changing the code, changing the location of the file.
The button should act as link and redirect the webpage to the link provided.
If you want to use button as a link , which redirect to next page ,you can do in below 3 ways.
HTML
You can use plain HTML ,and use <form> tag where you specify the desired target URL in the action attribute.Also set CSS display: inline;
<form action="https://microsoft.com">
<input type="submit" value="Go to Google" />
</form>
CSS
You can use <a> tag in CSS
Go to microsoft
JavaScript
If JavaScript is allowed, set the location.href.
<input type="button" onclick="location.href='https://microsoft.com';" value="Go to Google" />
Hope this helps
Thanks

How to add my CSS class to form in drupal 7

I newbie in drupal 7. I am writing new theme and I don't know how to add my class to form in drupal 7. I install ubercart to setup e-commerce website. I added new attribute for product (Size). I want to redesign in product page. In this page, It has size field but I don't know how to add my CSS. E.g:
<form action="/drupal-7.34/node/6" method="post" id="uc-product-add-to-cart-form-6" accept-charset="UTF-8"><div><div id="uc_product_add_to_cart_form-6-attributes" class="attributes"><div class="attribute attribute-1 odd"><div class="form-item form-type-select form-item-attributes-1">
<label for="edit-attributes-1">Size <span class="form-required" title="This field is required.">*</span></label>
<select id="edit-attributes-1" name="attributes[1]" class="form-select required"><option value="" selected="selected">- Select -</option><option value="1">39</option><option value="2">40</option><option value="3">41</option></select>
</div>
</div></div><input type="hidden" name="qty" value="1">
<input type="hidden" name="form_build_id" value="form-w06CKx7aNBiYShqfg8LiP98CaFLpEb8mgWzFYQWqnQ4">
<input type="hidden" name="form_token" value="JtZIrcKeIfXiVpwX43K6KqHPlZazR1klS1ht3W7PI9I">
<input type="hidden" name="form_id" value="uc_product_add_to_cart_form_6">
<div class="form-actions form-wrapper" id="edit-actions"><input class="node-add-to-cart form-submit" type="submit" id="edit-submit-6" name="op" value="Add to cart"></div></div></form>
I want to add my class to the select element. How can I do that?
In your theme directory there is file named theme_name.info . Inside of it there should be (or you can create it) array that defines css file which will be included on page. Check out explanation here:
https://www.drupal.org/node/171205
https://www.drupal.org/node/171209
So, you basically have to add path of your css file to that list and it will be included on every site page. Your html.php template must print out stylesheets variable (which will contain paths to css files). If you are not sure how to do it check how it's done on some standard drupal theme that comes with drupal installation.
After adding your css to theme info file don't forget to clear the cache!
Other way would be to include it manually, from page.tpl.php file. Just add there common CSS include line, like you would that in plain HTML file.
You can add CSS even from code with drupal_add_css() function, but that's a bit more advanced.
And you can use form id attribute to "aim" it and all inner elements with css.

Why my input with ng-model doesn't bind data to other element?

I have ASP.NET MVC5 application.
I included script like this:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
And I also did:
<input ng-model="someTest" type="text" />
<h1>Hello {{someTest}}</h1>
But when I write something into input, my <h1> doesnt update!
Console is clear, no errors, script is loaded correctly.
All I see on website is EXACTLY:
Hello {{someTest}}
What is wrong?
Even when I download script and include directly to project, problem is the same.
You likely need the ng-app tag, unless you have it somewhere that you aren't showing:
<div ng-app>
<input ng-model="someTest" type="text" />
<h1>Hello {{someTest}}</h1>
</div>

Why is wordpress now removing form tags from the HTML editor on publish?

I'm trying to insert a paypal button using their code into the HTML tab of the wordpress wysiwyg editor. When I publish and view the source code in chrome, the form tags don't show and the button action does not happen when clicked.
The form tags do remain there in wordpress, however.
Any knowledge of why these wouldn't be carrying over? I've never had this happen, and it was working last week, same code, same project.
Could it be the newest wordpress upgrade?
It's weird because another button on another page of the same site, from paypal as well, works still..
Code from paypal:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="QLFJU8MHD2XCN">
<input type="image" src="http://www.spmoh.com/wp-content/uploads/2012/06/donate-now.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
The form elements are still there in the source code. I can think of two possible reasons why they are removed in the DOM view:
Invalid nesting of elements, for example h1 elements (that are block level elements) inside a ones. At a quick glance, I can't see anything on that page that could be causing it, though
JavaScript removing the elements afterwards (e.g. some rogue jQuery cleanup script).

Drupal path problem - views vs node

I've got a problem with my site search not linking properly to my views pages. I've got a views page set up to display recipe data. It has the URL properties of:
index.php?q=recipe/%1/%2
where %1 is the recipe category, for example, breakfast, and %2 is the recipe name, for example, Muffin. The view goes through the recipe node content, and display it as appropriate. The problem is that the site search module doesn't link to the view, it links to the node which still can look like:
index.php?q=node/22
If I edit that node with an URL alias I can turn it into say:
index.php?q=recipe/muffin
But: this clashes with the view display on the site and the search function takes them to the NODE and not to the VIEW. I really, really need them to be taken to the view.
Is that clear?
How can it be fixed?
Edit: the view has variables for both recipe category and recipe name (for example, breakfast/muffin). Formatting the node pages themselves was impossible, so we had to use views, I'm afraid.
What does the view do exactly?
If it searches for nodes with the argument (say, "Muffin") in their titles, then I think that you should simply change the view URL to something like search_recipe and be done with it.
If it does do something like displaying a single node (so recipe/muffin would be an appropriate unique id), then why are you using Views for this?
Also, you can replace the site's search page with exposed view filters. It's pretty powerful.
This might work?
I've set up a searchable view form - with some filters exposed in the page (and so in the url).
I've disabled site search, don't need it anyway outside this recipe area, and I think I can build a simple block to $GET (or $POST, i always forget) form data to the view.
The view then reads the url and displays appropriately:
index.php?q=recipes%2Fsearch&time=All&keywords=pie
shows recipes containing "pie" in the title.
Just need to build the form now...
edit - yep this worked a treat!
<form id="search-block-form" action="index.php?q=recipes%2Fsearch&time=All" accept-charset="UTF-8" method="get">
<div>
<div class="container-inline right-search">
<div id="edit-search-block-form-1-wrapper" class="form-item">
<label for="edit-search-block-form-1">Quick recipe search: </label>
<input name="q" value="recipes/search" type="hidden" />
<input name="time" value="All" type="hidden" />
<input id="edit-search-block-form-1" class="form-text" title="Enter the recipe terms you wish to search for." maxlength="128" name="keywords" size="15" type="text" />
</div>
<input id="edit-submit" class="form-submit" name="op" type="submit" value="Search" />
</div>
</div>
</form>
This is kind of a workaround, but:
You can try Google Custom Search Engine as default search, and make Google not see node/* URL's using robots.txt.
Just add this below "# Paths (clean URLs)" in the robots.txt file which is on the Drupal root:
Disallow: /node/
(Don't forget that adding this line will stop search engines from crawling all the node/** URLs.)
Also adding views to the sitemap could be helpful for this process.
I've never tried this process, so I can't be sure if it's working or not ;)

Resources