Input type submit value send error report to support

Доброго времени суток!Возникла небольшая проблема, на сайте работала интеграция до поры до времени пока чьито ручки не залезли и не поправили, если с Битрикс я както знаком то вот с 1С уже сложнее.  Со стороны сайта все проверено все согласно мануалам и документации, со стороны 1С - проверка связи с сайтом проходит на отлично но вот сама выгрузка дает такое:Выгружено товаров: 19Выгружено картинок: 15Произошла ошибка на стороне сервера. Получен неизвестный статус импорта.Обмен не...

Выгрузка с ошибками

 

Пользователь 104272

Заглянувший

Сообщений: 18
Регистрация: 13.10.2011

#1

26.04.2012 21:02:42

Доброго времени суток!
Возникла небольшая проблема, на сайте работала интеграция до поры до времени пока чьито ручки не залезли и не поправили, если с Битрикс я както знаком то вот с 1С уже сложнее.  Со стороны сайта все проверено все согласно мануалам и документации, со стороны 1С — проверка связи с сайтом проходит на отлично но вот сама выгрузка дает такое:

Код
 Выгружено товаров: 19
Выгружено картинок: 15
Произошла ошибка на стороне сервера. Получен неизвестный статус импорта.
Обмен не выполнен
Ответ сервера:
   select
    ID, ATTRIBUTES
   from
    b_xml_tree
   where (ID = 1) and (NAME = 'КоммерческаяИнформация')
   
  </font>[Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (cp1251_general_ci,COERCIBLE) for operation '=']<br><br>
<table cellpadding="1" cellspacing="0" width="35%" bgcolor="#9C9A9C">
 <tr>
  <td><table cellpadding="5" cellspacing="0" width="100%">
   <tr>
    <td bgcolor="#FFFFFF" align="center">
     <FONT face="Verdana, Arial, Helvetica, sans-serif" size="-1">
     <font color="#FF0000"><b>DB query error.</b></font><br>
     Please try later.
     </font><br>
        </form>
   <form method="post" action="/bitrix/admin/site_checker.php?tabControl_active_tab=edit5#edit5">
              <input type="hidden" name="last_error_query" value="File: ........../bitrix/modules/main/include/dbquery_error.php
Query: 
   select
    ID, ATTRIBUTES
   from
    b_xml_tree
   where (ID = 1) and (NAME = 'КоммерческаяИнформация')
   
  
[Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (cp1251_general_ci,COERCIBLE) for operation '=']
debug_backtrace:
Array
(
    [0] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/mysql/database.php
      [line] =&gt; 175
      [class] =&gt; 
      [function] =&gt; include
      [args] =&gt; 
     )
    [1] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/iblock/classes/mysql/cml2.php
      [line] =&gt; 607
      [class] =&gt; CDatabase
      [function] =&gt; Query
      [args] =&gt; Array
          (
           [0] =&gt; 
   select
    ID, ATTRIBUTES
   from
    b_xml_tree
   where (ID = 1) and (NAME = 'КоммерческаяИнформация')
   
  
          )
     )
    [2] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/iblock/classes/general/cml2.php
      [line] =&gt; 370
      [class] =&gt; CIBlockXMLFile
      [function] =&gt; GetList
      [args] =&gt; Array
          (
           [0] =&gt; Array
            (
            ;)
           [1] =&gt; Array
            (
                [ID] =&gt; 1
                [NAME] =&gt; КоммерческаяИнформация
            ;)
           [2] =&gt; Array
            (
                [0] =&gt; ID
                [1] =&gt; ATTRIBUTES
            ;)
          )
     )
    [3] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/components/bitrix/catalog.import.1c/component.php
      [line] =&gt; 243
      [class] =&gt; CIBlockCMLImport
      [function] =&gt; ImportMetaData
      [args] =&gt; Array
          (
           [0] =&gt; 1
           [1] =&gt; xmlcatalog
           [2] =&gt; Array
            (
                [0] =&gt; s1
            ;)
          )
     )
    [4] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/general/component.php
      [line] =&gt; 192
      [class] =&gt; 
      [function] =&gt; include
      [args] =&gt; Array
          (
           [0] =&gt; .......... /bitrix/components/bitrix/catalog.import.1c/component.php
          )
     )
    [5] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/general/component.php
      [line] =&gt; 228
      [class] =&gt; CBitrixComponent
      [function] =&gt; __IncludeComponent
      [args] =&gt; Array
          (
          )
     )
    [6] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/general/main.php
      [line] =&gt; 979
      [class] =&gt; CBitrixComponent
      [function] =&gt; IncludeComponent
      [args] =&gt; Array
          (
           [0] =&gt; 
           [1] =&gt; Array
            (
                [IBLOCK_TYPE] =&gt; xmlcatalog
                [SITE_LIST] =&gt; Array
                 (
                  [0] =&gt; s1
                 )
                [INTERVAL] =&gt; 30
                [GROUP_PERMISSIONS] =&gt; Array
                 (
                  [0] =&gt; 5
                 )
                [GENERATE_PREVIEW] =&gt; Y
                [PREVIEW_WIDTH] =&gt; 100
                [PREVIEW_HEIGHT] =&gt; 100
                [DETAIL_RESIZE] =&gt; Y
                [DETAIL_WIDTH] =&gt; 300
                [DETAIL_HEIGHT] =&gt; 300
                [ELEMENT_ACTION] =&gt; A
                [SECTION_ACTION] =&gt; A
                [FILE_SIZE_LIMIT] =&gt; 204800
                [USE_CRC] =&gt; Y
                [USE_ZIP] =&gt; Y
                [USE_OFFERS] =&gt; N
                [USE_IBLOCK_TYPE_ID] =&gt; Y
            ;)
           [2] =&gt; 
          )
     )
    [7] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/sale/admin/1c_exchange.php
      [line] =&gt; 41
      [class] =&gt; CAllMain
      [function] =&gt; IncludeComponent
      [args] =&gt; Array
          (
           [0] =&gt; bitrix:catalog.import.1c
           [1] =&gt; 
           [2] =&gt; Array
            (
                [IBLOCK_TYPE] =&gt; xmlcatalog
                [SITE_LIST] =&gt; Array
                 (
                  [0] =&gt; s1
                 )
                [INTERVAL] =&gt; 30
                [GROUP_PERMISSIONS] =&gt; Array
                 (
                  [0] =&gt; 5
                 )
                [GENERATE_PREVIEW] =&gt; Y
                [PREVIEW_WIDTH] =&gt; 100
                [PREVIEW_HEIGHT] =&gt; 100
                [DETAIL_RESIZE] =&gt; Y
                [DETAIL_WIDTH] =&gt; 300
                [DETAIL_HEIGHT] =&gt; 300
                [ELEMENT_ACTION] =&gt; A
                [SECTION_ACTION] =&gt; A
                [FILE_SIZE_LIMIT] =&gt; 204800
                [USE_CRC] =&gt; Y
                [USE_ZIP] =&gt; Y
                [USE_OFFERS] =&gt; N
                [USE_IBLOCK_TYPE_ID] =&gt; Y
            ;)
          )
     )
    [8] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/admin/1c_exchange.php
      [line] =&gt; 2
      [class] =&gt; 
      [function] =&gt; require_once
      [args] =&gt; Array
          (
           [0] =&gt; .......... /bitrix/modules/sale/admin/1c_exchange.php
          )
     )
)
">
    <input type="submit" value="Send error report to support">
   </form>
      </td>
   </tr>
  </table></td>
 </tr>
</table> 
<br><br><br>
Выгрузка товаров завершена с ошибками!!!
 

Пользователь 105835

Эксперт

Сообщений: 761
Баллов: 122
Регистрация: 28.10.2011

#2

27.04.2012 00:34:44

Цитата
Vegard пишет:
Доброго времени суток!
Возникла небольшая проблема, на сайте работала интеграция до поры до времени пока чьито ручки не залезли и не поправили, если с Битрикс я както знаком то вот с 1С уже сложнее. Со стороны сайта все проверено все согласно мануалам и документации, со стороны 1С — проверка связи с сайтом проходит на отлично но вот сама выгрузка дает такое:

Код
  Выгружено товаров: 19
Выгружено картинок: 15
Произошла ошибка на стороне сервера. Получен неизвестный статус импорта.
Обмен не выполнен
Ответ сервера:
   select
    ID, ATTRIBUTES
   from
    b_xml_tree
   where (ID = 1) and (NAME = 'КоммерческаяИнформация')
   
  </font>[Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (cp1251_general_ci,COERCIBLE) for operation '=']<br><br>
<table cellpadding="1" cellspacing="0" width="35%" bgcolor="#9C9A9C">
 <tr>
  <td><table cellpadding="5" cellspacing="0" width="100%">
   <tr>
    <td bgcolor="#FFFFFF" align="center">
     <FONT face="Verdana, Arial, Helvetica, sans-serif" size="-1">
     <font color="#FF0000"><b>DB query error.</b></font><br>
     Please try later.
     </font><br>
        </form>
   <form method="post" action="/bitrix/admin/site_checker.php?tabControl_active_tab=edit5#edit5">
              <input type="hidden" name="last_error_query" value="File: ........../bitrix/modules/main/include/dbquery_error.php
Query: 
   select
    ID, ATTRIBUTES
   from
    b_xml_tree
   where (ID = 1) and (NAME = 'КоммерческаяИнформация')
   
  
[Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (cp1251_general_ci,COERCIBLE) for operation '=']
debug_backtrace:
Array
(
    [0] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/mysql/database.php
      [line] =&gt; 175
      [class] =&gt; 
      [function] =&gt; include
      [args] =&gt; 
     )
    [1] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/iblock/classes/mysql/cml2.php
      [line] =&gt; 607
      [class] =&gt; CDatabase
      [function] =&gt; Query
      [args] =&gt; Array
          (
           [0] =&gt; 
   select
    ID, ATTRIBUTES
   from
    b_xml_tree
   where (ID = 1) and (NAME = 'КоммерческаяИнформация')
   
  
          )
     )
    [2] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/iblock/classes/general/cml2.php
      [line] =&gt; 370
      [class] =&gt; CIBlockXMLFile
      [function] =&gt; GetList
      [args] =&gt; Array
          (
           [0] =&gt; Array
            (
            ;)
           [1] =&gt; Array
            (
                [ID] =&gt; 1
                [NAME] =&gt; КоммерческаяИнформация
            ;)
           [2] =&gt; Array
            (
                [0] =&gt; ID
                [1] =&gt; ATTRIBUTES
            ;)
          )
     )
    [3] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/components/bitrix/catalog.import.1c/component.php
      [line] =&gt; 243
      [class] =&gt; CIBlockCMLImport
      [function] =&gt; ImportMetaData
      [args] =&gt; Array
          (
           [0] =&gt; 1
           [1] =&gt; xmlcatalog
           [2] =&gt; Array
            (
                [0] =&gt; s1
            ;)
          )
     )
    [4] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/general/component.php
      [line] =&gt; 192
      [class] =&gt; 
      [function] =&gt; include
      [args] =&gt; Array
          (
           [0] =&gt; .......... /bitrix/components/bitrix/catalog.import.1c/component.php
          )
     )
    [5] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/general/component.php
      [line] =&gt; 228
      [class] =&gt; CBitrixComponent
      [function] =&gt; __IncludeComponent
      [args] =&gt; Array
          (
          )
     )
    [6] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/main/classes/general/main.php
      [line] =&gt; 979
      [class] =&gt; CBitrixComponent
      [function] =&gt; IncludeComponent
      [args] =&gt; Array
          (
           [0] =&gt; 
           [1] =&gt; Array
            (
                [IBLOCK_TYPE] =&gt; xmlcatalog
                [SITE_LIST] =&gt; Array
                 (
                  [0] =&gt; s1
                 )
                [INTERVAL] =&gt; 30
                [GROUP_PERMISSIONS] =&gt; Array
                 (
                  [0] =&gt; 5
                 )
                [GENERATE_PREVIEW] =&gt; Y
                [PREVIEW_WIDTH] =&gt; 100
                [PREVIEW_HEIGHT] =&gt; 100
                [DETAIL_RESIZE] =&gt; Y
                [DETAIL_WIDTH] =&gt; 300
                [DETAIL_HEIGHT] =&gt; 300
                [ELEMENT_ACTION] =&gt; A
                [SECTION_ACTION] =&gt; A
                [FILE_SIZE_LIMIT] =&gt; 204800
                [USE_CRC] =&gt; Y
                [USE_ZIP] =&gt; Y
                [USE_OFFERS] =&gt; N
                [USE_IBLOCK_TYPE_ID] =&gt; Y
            ;)
           [2] =&gt; 
          )
     )
    [7] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/modules/sale/admin/1c_exchange.php
      [line] =&gt; 41
      [class] =&gt; CAllMain
      [function] =&gt; IncludeComponent
      [args] =&gt; Array
          (
           [0] =&gt; bitrix:catalog.import.1c
           [1] =&gt; 
           [2] =&gt; Array
            (
                [IBLOCK_TYPE] =&gt; xmlcatalog
                [SITE_LIST] =&gt; Array
                 (
                  [0] =&gt; s1
                 )
                [INTERVAL] =&gt; 30
                [GROUP_PERMISSIONS] =&gt; Array
                 (
                  [0] =&gt; 5
                 )
                [GENERATE_PREVIEW] =&gt; Y
                [PREVIEW_WIDTH] =&gt; 100
                [PREVIEW_HEIGHT] =&gt; 100
                [DETAIL_RESIZE] =&gt; Y
                [DETAIL_WIDTH] =&gt; 300
                [DETAIL_HEIGHT] =&gt; 300
                [ELEMENT_ACTION] =&gt; A
                [SECTION_ACTION] =&gt; A
                [FILE_SIZE_LIMIT] =&gt; 204800
                [USE_CRC] =&gt; Y
                [USE_ZIP] =&gt; Y
                [USE_OFFERS] =&gt; N
                [USE_IBLOCK_TYPE_ID] =&gt; Y
            ;)
          )
     )
    [8] =&gt; Array
     (
      [file] =&gt; .......... /bitrix/admin/1c_exchange.php
      [line] =&gt; 2
      [class] =&gt; 
      [function] =&gt; require_once
      [args] =&gt; Array
          (
           [0] =&gt; .......... /bitrix/modules/sale/admin/1c_exchange.php
          )
     )
)
">
    <input type="submit" value="Send error report to support">
   </form>
      </td>
   </tr>
  </table></td>
 </tr>
</table> 
<br><br><br>
Выгрузка товаров завершена с ошибками!!! 

Попробуйте выгрузить в каталог из 1С. Если ок, значит на стороне сайта что-то. Установите локально демо сайт и настройте синхронизацию с ним.
Проверьте свободное место на хостинге.
Проверьте сайт на ошибки.
Попробуйте выгрузить в другой инфоблок.

Битрикс и Битрикс 24 РАБОТА ВАКАНСИИ — https://t.me/bitrixworkrabota

 

Пользователь 18609

Постоянный посетитель

Сообщений: 182
Баллов: 27
Регистрация: 11.12.2007

#3

27.04.2012 10:13:59

Да не надо ничего пробовать в 1С и свободное место проверять тоже не надо. Написано же:

Код
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (cp1251_general_ci,COERCIBLE) for operation '='

Росинтеграл — знаем об интеграции всё.

<input> elements of type submit are rendered as buttons. When the click event occurs (typically because the user clicked the button), the user agent attempts to submit the form to the server.

Value

An <input type="submit"> element’s value attribute contains a string which is displayed as the button’s label. Buttons do not have a true value otherwise.

Setting the value attribute

<input type="submit" value="Send Request" />

Omitting the value attribute

If you don’t specify a value, the button will have a default label, chosen by the user agent. This label is likely to be something along the lines of «Submit» or «Submit Query.» Here’s an example of a submit button with a default label in your browser:

Additional attributes

In addition to the attributes shared by all <input> elements, submit button inputs support the following attributes.

formaction

A string indicating the URL to which to submit the data. This takes precedence over the action attribute on the <form> element that owns the <input>.

This attribute is also available on <input type="image"> and <button> elements.

formenctype

A string that identifies the encoding method to use when submitting the form data to the server. There are three permitted values:

application/x-www-form-urlencoded

This, the default value, sends the form data as a string after URL encoding the text using an algorithm such as encodeURI().

multipart/form-data

Uses the FormData API to manage the data, allowing for files to be submitted to the server. You must use this encoding type if your form includes any <input> elements of type file (<input type="file">).

text/plain

Plain text; mostly useful only for debugging, so you can easily see the data that’s to be submitted.

If specified, the value of the formenctype attribute overrides the owning form’s action attribute.

This attribute is also available on <input type="image"> and <button> elements.

formmethod

A string indicating the HTTP method to use when submitting the form’s data; this value overrides any method attribute given on the owning form. Permitted values are:

get

A URL is constructed by starting with the URL given by the formaction or action attribute, appending a question mark («?») character, then appending the form’s data, encoded as described by formenctype or the form’s enctype attribute. This URL is then sent to the server using an HTTP get request. This method works well for simple forms that contain only ASCII characters and have no side effects. This is the default value.

post

The form’s data is included in the body of the request that is sent to the URL given by the formaction or action attribute using an HTTP post method. This method supports complex data and file attachments.

dialog

This method is used to indicate that the button closes the dialog with which the input is associated, and does not transmit the form data at all.

This attribute is also available on <input type="image"> and <button> elements.

formnovalidate

A Boolean attribute which, if present, specifies that the form should not be validated before submission to the server. This overrides the value of the novalidate attribute on the element’s owning form.

This attribute is also available on <input type="image"> and <button> elements.

formtarget

A string which specifies a name or keyword that indicates where to display the response received after submitting the form. The string must be the name of a browsing context (that is, a tab, window, or <iframe>). A value specified here overrides any target given by the target attribute on the <form> that owns this input.

In addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used:

_self

Loads the response into the same browsing context as the one that contains the form. This will replace the current document with the received data. This is the default value used if none is specified.

_blank

Loads the response into a new, unnamed, browsing context. This is typically a new tab in the same window as the current document, but may differ depending on the configuration of the user agent.

_parent

Loads the response into the parent browsing context of the current one. If there is no parent context, this behaves the same as _self.

_top

Loads the response into the top-level browsing context; this is the browsing context that is the topmost ancestor of the current context. If the current context is the topmost context, this behaves the same as _self.

This attribute is also available on <input type="image"> and <button> elements.

Using submit buttons

<input type="submit"> buttons are used to submit forms. If you want to create a custom button and then customize the behavior using JavaScript, you need to use <input type="button">, or better still, a <button> element.

If you choose to use <button> elements to create the buttons in your form, keep this in mind: If the <button> is inside a <form>, that button will be treated as the «submit» button. So you should be in the habit of expressly specifying which button is the submit button.

A simple submit button

We’ll begin by creating a form with a simple submit button:

<form>
  <div>
    <label for="example">Let's submit some text</label>
    <input id="example" type="text" name="text" />
  </div>
  <div>
    <input type="submit" value="Send" />
  </div>
</form>

This renders like so:

Try entering some text into the text field, and then submitting the form.

Upon submitting, the data name/value pair gets sent to the server. In this instance, the string will be text=usertext, where «usertext» is the text entered by the user, encoded to preserve special characters. Where and how the data is submitted depends on the configuration of the <form>; see Sending form data for more details.

Adding a keyboard shortcut to a submit button

Keyboard shortcuts, also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. To add a keyboard shortcut to a submit button — just as you would with any <input> for which it makes sense — you use the accesskey global attribute.

In this example, s is specified as the access key (you’ll need to press s plus the particular modifier keys for your browser/OS combination). In order to avoid conflicts with the user agent’s own keyboard shortcuts, different modifier keys are used for access keys than for other shortcuts on the host computer. See accesskey for further details.

Here’s the previous example with the s access key added:

<form>
  <div>
    <label for="example">Let's submit some text</label>
    <input id="example" type="text" name="text" />
  </div>
  <div>
    <input type="submit" value="Send" accesskey="s" />
  </div>
</form>

For example, in Firefox for Mac, pressing ControlOptionS triggers the Send button, while Chrome on Windows uses Alt+S.

The problem with the above example is that the user will not know what the access key is! This is especially true since the modifiers are typically non-standard to avoid conflicts. When building a site, be sure to provide this information in a way that doesn’t interfere with the site design (for example by providing an easily accessible link that points to information on what the site access keys are). Adding a tooltip to the button (using the title attribute) can also help, although it’s not a complete solution for accessibility purposes.

Disabling and enabling a submit button

To disable a submit button, specify the disabled attribute on it, like so:

<input type="submit" value="Send" disabled />

You can enable and disable buttons at run time by setting disabled to true or false; in JavaScript this looks like btn.disabled = true or btn.disabled = false.

Note: See the <input type="button"> page for more ideas about enabling and disabling buttons.

Validation

Submit buttons don’t participate in constraint validation; they have no real value to be constrained.

Examples

We’ve included simple examples above. There isn’t really anything more to say about submit buttons. There’s a reason this kind of control is sometimes called a «simple button.»

Technical Summary

Value A string used as the button’s label
Events click
Supported common attributes type and
value
IDL attributes value
DOM interface

HTMLInputElement

Methods None
Implicit ARIA Role button

Specifications

Specification
HTML Standard
# submit-button-state-(type=submit)

Browser compatibility

BCD tables only load in the browser

See also

If you don’t know what an element is or how you must use it, I recommend you read the «HTML tags and attributes» tutorial that you can find in the HTML tutorials section.

Table of contents

  • 01Description
  • 02Examples
  • 03Attributes
    • Specific attributes
    • Global attributes
  • 04Events
    • Global events

Description

The input element, having the «submit» value in its type attribute, represents a button that, when pressed, submits the form it belongs to.

With the arrival of HTML5, several new attributes have been added to this element (formaction, formenctype, formmethod, formnovalidate and formtarget) that define and override certain parameters pertaining how the form must be submitted. These new attributes can be used, for example, to provide more than one submit button in one form, and make each of them perform a different type of submission.

The value attribute has a particular meaning for this element: it represents the label of the button, that is usually shown by browsers inside of it.

Examples

In our first example we’ll create a basic form with a couple of fields and a submit button. Here you’ll be able to see and test the functionality of the submit button: when you press it, the form is automatically submitted.

<form action="../../form-result.php" method="post" target="_blank">
  <p>Username: <input type="text" name="user"></p>
  <p>Password: <input type="password" name="pass"></p>
  <p><input type="submit" value="Send data"></p>
</form>

Now, we’ll provide two submit buttons in the same form, and we’ll make each perform a different type of submission. While the first button uses the default configuration declared in the form element, the second overrides some of the original attributes and produces a submission using the GET method, with no validation of data.

<form action="../../form-result.php" method="post" target="_blank">
  <p>Username: <input type="text" name="user" pattern="^[a-zA-Z][a-zA-Z0-9-_.]{3,15}$" title="A proper username must begin with a letter, contain letters, numbers, scores and stops, and have between 3 and 15 characters long" required></p>
  <p>Password: <input type="password" name="pass" pattern="[a-zA-Z0-9]{6,15}" title="A valid password must be composed by letters and/or numbers and have a length between 6 and 15 characters" required></p>
  <p>
    <input type="submit" value="Send">
    <input type="submit" value="Send without validation" formmethod="get" formnovalidate>
  </p>
</form>

Attributes

Specific attributes

autofocus

A boolean value instructing the browser to set the focus to this control when the document has finished loading or when the dialog where the control finds itself is shown. If the attribute has the value «autofocus» or the empty string («»), or if it’s just present, the control should get the focus as soon as possible, after the page or dialog has been loaded.

Example

<p><input type="submit" value="Send data" autofocus></p>

disabled

A boolean value indicating wether the control is disabled or not. If the attribute takes the value «disabled» or the empty string («»), or if it’s just present, the control will be disabled.

Disabled controls are rendered greyed out (if visible), are blocked from user interaction and, more importantly, their values (if any) aren’t sent when the form is submitted.

Example

<form action="../../form-result.php" method="post" target="_blank">
  <p>
    Key word: <input type="text" name="keyword">
    <input type="submit" value="Send data" disabled>
  </p>
</form>

form

The value of the id attribute of the form with which this control is associated to.

This attribute is new in HTML5 and helps defining the pertenence of controls in nested or distant forms.

Example

<form id="form1" action="../../form-result.php" method="post" target="_blank">
  <p>Surname: <input type="text" name="surname"><p>
</form>
<p><input type="submit" value="Send data" form="form1"></p>

formaction

A URI indicating the location of the script responsible for the manipulation of the data sent by the form. This script is usually written in a server-side language like ASP, PHP, Python, etc.

This attribute is new in HTML5 and, if present, overrides the action attribute of the form element. This allows authors to provide one form with two or more buttons that perform different types of submissions.

Example

<form method="post" target="_blank">
  <p>
    Nombre: <input type="text" name="nombre">
    <input type="submit" value="Enviar datos" formaction="../../form-result.php">
  </p>
</form>

formenctype

A value indicating the encoding method to be used for data when the form is submitted. There are three possible case-insensitive values:

  • application/x-www-form-urlencoded: spaces are replaced with plus signs («+») and special characters are converted to HEX values. This is the default value.
  • multipart/form-data: no encoding is performed. This value is necessary for file uploads.
  • text/plain: only spaces are replaced by plus signs («+»).

Remember you must use the value «multipart/form-data» whenever a file is going to be uploaded in the form. Without this configuration, file uploads will fail.

This attribute is new in HTML5 and, if present, overrides the action attribute of the form element. This allows authors to provide one form with two or more buttons that perform different types of submissions.

Example

<form action="../../form-result.php" target="_blank">
  <p>Full name: <input type="text" name="fullname"></p>
  <p>Picture: <input type="file" name="picture"></p>
  <p>
    <input type="submit" value="Send with picture" formenctype="multipart/form-data">
    <input type="submit" value="Send without picture">
  </p>
</form>

formmethod

The method browsers should use to send the form’s data. There are three possible case-insensitive values:

  • get: data is attached to the URL of the request (the one provided in the action attribute). The name-value pairs are arranged in the form «name=value» and separated each other with an ampersand sign («&»). All this string is appended to the request URL preceded by a question mark («?»). For example, a GET string could be: «form-result.php?user=john&pass=123456»
  • post: data is attached to the body of the request.
  • dialog: specific for forms inside a dialog element. Instructs the browser to close the dialog box upon form submission. Form results should be handled by scripts.

This attribute is new in HTML5 and, if present, overrides the action attribute of the form element. This allows authors to provide one form with two or more buttons that perform different types of submissions.

Example

<form action="../../form-result.php" target="_blank">
  <p>
    City: <input type="text" name="city">
    <input type="submit" value="Send with GET" formmethod="get">
    <input type="submit" value="Send with POST" formmethod="post">
  </p>
</form>

formtarget

A value specifiyng where the results of the script in charge of processing the data should be loaded. This value can be a browsing-context name (like the value of the name attribute of an iframe) or any of the following values (case-insensitive):

  • _blank: in a new window/tab.
  • _parent: in the immediate parent context.
  • _self: in the same context that’s containing the form.
  • _top: in the topmost context (the greatest parent context containing the form).

This attribute is new in HTML5 and, if present, overrides the action attribute of the form element. This allows authors to provide one form with two or more buttons that perform different types of submissions.

Example

<form action="../../form-result.php" method="post">
  <p>
    Group: <input type="text" name="group">
    <input type="submit" value="Submit" formtarget="_blank">
  </p>
</form>

formnovalidate

A boolean value instructing the browser not to validate the form’s data upon submission. If this attribute takes the value «formnovalidate» or the empty string («»), or if it’s just present, the browser should omit the form’s validation during submission.

This attribute is new in HTML5 and, if present, overrides the action attribute of the form element. This allows authors to provide one form with two or more buttons that perform different types of submissions.

This attribute is part of the Constraint Validation API, a new feature that allows authors to provide form validation with minimal programming intervention.

Example

<form action="../../form-result.php" target="_blank">
  <p>
    Username: <input type="text" name="user" pattern="^[a-zA-Z][a-zA-Z0-9-_.]{3,15}$" title="A proper username must begin with a letter, contain letters, numbers, scores and stops, and have between 3 and 15 characters long" required>
    <input type="submit" value="Send">
    <input type="submit" value="Send without validating" formnovalidate>
  </p>
</form>

name

A name for the control. This name will be sent by the browser to the processing agent, paired with the content of the value attribute. Both attributes together will conform a name-value pair that will be used to process the form data.

Currently, the value isindex, formerly used in a special way by some browsers and included in the HTML standard, isn’t permitted in this attribute.

The name-value pair of a button is submitted, with the other form data, only if the button has been used to submit the form.

Example

<form action="../../form-result.php" method="post" target="_blank">
  <p>
    Partner name: <input type="text" name="partnername">
    <input type="submit" name="submitbutton" value="Submit">
  </p>
</form>

type

A value indicating the type of the field that this element represents. There are twenty two possible values (case-insensitive):

  • hidden: a hidden control used to send information to the server, typically managed by scripts.
  • text: a control used to input a single-line piece of text.
  • search: same as text but for search purposes.
  • tel: a control used to provide a telephone number.
  • url: a text box used to input a single and absolute URL.
  • email: a control designed to edit one or more e-mail addresses.
  • password: a text box for editing passwords, where the characters are represented by dots.
  • date: a control to input a specific date.
  • month: a control to input a specific month.
  • week: a control to input a specific week.
  • time: a control to input a specific time.
  • datetime-local: a control to input a specific local date and time.
  • number: a control to input a number.
  • range: a control to input one or two numbers inside a range.
  • color: a control to input a color.
  • checkbox: a control to input a boolean value (true/false).
  • radio: a control used to choose one single option among many.
  • file: a control used to upload files to the server.
  • submit: a button used to submit the form.
  • image: same as submit but with the ability to be shown as an image instead of using the default button appearance.
  • reset: a button used to reset the form’s controls to their default values.
  • button: a button with no default action associated.

When this attribute isn’t present, the element behaves as it would have the value «text».

Example

<input type="submit" value="Submit data">

value

A value for the control. This value will be sent by the browser to the processing agent, paired with the content of the name attribute. Both attributes together will conform a name-value pair that will be used to process the form data.

Additionally, browsers will use the content of this attribute as a label for the button.

The name-value pair of a button is submitted, with the other form data, only if the button has been used to submit the form.

Processing agents will find little use in the name-value pair passed by a button. Instead, the value attribute has a more important task providing the label that browsers will display as content of the button.

Example

<form action="../../form-result.php" method="post" target="_blank">
  <p>
    Search: <input type="search" name="searchstring" value="Autum"></p>
    <input type="submit" name="submitbutton" value="Search">
  </p>
</form>

Global attributes

For information about global attributes refer to this list of global attributes in HTML5.

Events

Global events

For information about global events refer to this list of global events in HTML5.

<input> elements of type "submit" are rendered as submit buttons — clicking one will attempt to submit the form to the sever.

<input type="submit" value="Submit to me">

Value

An <input type="submit"> elements’ value attribute contains a DOMString that is used as the button’s label.

<input type="submit" value="Submit to me">

If you don’t specify a value, you get an button with a default label like Submit/Submit Query (depending on the browser):

Using submit buttons

<input type="submit"> buttons are used to submit forms. If you want to create a custom button and then customize the behaviour using JavaScript, you need to use <input type="button">, or better still, a <button> element.

You do however need to bear in mind that if you only include a single button element inside a form (e.g. <button>My button</button>), the browser will count this as the submit button. You need to explicitly declare a submit button in addition to any other buttons you may want to include.

A simple submit button

We’ll begin by creating a simple submit button:

<form> 
  <div>
    <label for="example">Let's submit some text</label>
    <input id="example" type="text" name="text">
  </div>
  <div>
    <input type="submit" value="Submit to me">
  </div>
</form>

This renders like so:

Try entering some text into the text field, and then submitting the form.

Upon submitting, the data name/value pair sent to the server in this case will be along the lines of text=mytext, depending on what text you entered into the text field. Where and how the data is submitted depends on how you set the <form> attributes (and other details) up — see Sending form data for more details.

Adding a submit keyboard shortcut

Keyboard shortcuts, also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. To add a keyboard shortcut to a submit button — just as you would with any <input> for which it makes sense — you use the accesskey global attribute.

In this example, s is specified as the access key (you’ll need to press s plus the particular modifier keys for your browser/OS combination; see accesskey for a useful list of those).

<form>
  <div>
    <label for="example">Let's submit some text</label>
    <input id="example" type="text" name="text">
  </div>
  <div>
    <input type="submit" value="Submit to me"
     accesskey="s">
  </div>
</form>

Note: The problem with the above example of course is that the user will not know what the access key is! In a real site, you’d have to provide this information in a way that doesn’t intefere with the site design (for example by providing an easily accessible link that points to information on what the site accesskeys are).

Disabling and enabling a submit button

To disable a submit button, simply specify the disabled global attribute on it, like so:

<input type="submit" value="Disabled" disabled>

You can enable and disable buttons at run time by simply setting disabled to true or false; in JavaScript this looks like btn.disabled = true.

Note: See the <input type="button"> page for more ideas about enabling/disabling buttons.

Validation

Submit buttons don’t participate in constraint validation; they have no real value to be constrained.

Examples

We’ve included simple examples above. There isn’t really anything more to say about submit buttons. 

Specifications

Browser compatibility

  • Desktop
  • Mobile
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 or earlier) (Yes) (Yes) 1.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) 4.0 (4.0) (Yes) (Yes) (Yes)

See also

  • <input> and the HTMLInputElement interface which implements it.
  • The <button> element.

Понравилась статья? Поделить с друзьями:
  • Input signal out of range change settings to 1280x1024 60hz как исправить
  • Input show error js
  • Input output error while writing out and closing file system
  • Input output error ssd
  • Input output error ntfs linux