Jump to content

Set form attributes [SOLVED]


gizomo
 Share

Recommended Posts

I need to set an attribute for form with single quotes inside the value.

Now I have this code:

  private function getForm($options) {
    $form = $this->modules->get('InputfieldForm');
    $form->action = isset($options['action']) ? $options['action'] : './';
    $form->method = 'post';
    $form->attr([
		'id+name' => 'contact-form',
		'onsubmit' => "ym(53558719, 'reachGoal', 'form_question'); return true;"
	]);
...
}

But on the frontend there is an output:

<form id="contact-form" class="form js-simplecontactform InputfieldForm" name="contact-form" method="post" action="./#question" onsubmit="ym(53558719, &#039;reachGoal&#039;, &#039;form_question&#039;); return true;" data-colspacing="1">

Backslashes before single quotes don't help. The quotes turn into &#039;

What should I do?

Link to comment
Share on other sites

12 minutes ago, gizomo said:

What I should do?

Nothing. Escaping single quotes as HTML entities is perfectly valid and just an optical thing, the behavior stays the same as if there were literal single quotes.

  • Like 1
Link to comment
Share on other sites

3 hours ago, BitPoet said:

Nothing. Escaping single quotes as HTML entities is perfectly valid and just an optical thing, the behavior stays the same as if there were literal single quotes.

Thanks. I thought its unavailable.

Link to comment
Share on other sites

  • gizomo changed the title to Set form attributes [SOLVED]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...