Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi, @KK :)
I have 3 images for a user to select a language. So, I'm reusing the code repeated for each language.
Code: Select all
<cms:form method="post" anchor='0' >
   <cms:if k_success >
      <cms:set_session name='language' value='en' />
      <cms:redirect k_page_link />   
   </cms:if>
   <cms:input name="submit" type="submit" class="us rounded"/>
</cms:form>

In the html output i get
Code: Select all
<a name="kformname0"></a>
<form  method="post" name="kformname0" action="" accept-charset="utf-8">
    <input type="submit" name="submit"  id="submit" value=""  class="us rounded"/>
    <input type="hidden" name="k_hid_kformname0" id="k_hid_kformname0" value="kformname0" />
</form>

Do I need this
Code: Select all
<a name="kformname0"></a>
to be present in my code? Now it messes styling of my other links, which happen to exist in same section of code. Of course, I can restyle everything, but my curiosity is over the top :)
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Hi :)

When anchor='1' is set for the form, Couch sets the 'action' parameter to action="#kformname0" to make the user return to the form after submission.
It is then that this anchor comes into play.

With anchor='0' (as in your code), the 'action' parameter is left untouched. Ideally the anchor should also not be outputted as it is no longer used.

I'll make the change to the code base.
For now, you can find and edit the following line 4058 in couch/tags.php
Code: Select all
$html = '<a name="'.$name.'"></a>' . $html; //anchor for return

and make it as follows -
Code: Select all
if( $anchor ){
    $html = '<a name="'.$name.'"></a>' . $html; //anchor for return
}

Hope it helps.
@KK, thank you! Will update the code.

When I'm done with my 3-languages 1-page/6-templates site, I want to put it on forum as a template for others. I hope, refactoring code might help someone to learn faster. :)

edit: Did in http://www.couchcms.com/forum/viewtopic.php?f=7&t=9696&p=21886#p21886
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
3 posts Page 1 of 1