Answer the question
In order to leave comments, you need to log in
How to make it redirect to a separate page after filling out and submitting the form?
Есть всплывающее окно с формой для ввода номера телефона, нужно сделать, чтобы при отправки заполненной формы человека отправляло на страницу.
Тоесть когда пользователь нажимает на кнопку "БРОНИРОВАТЬ", то его должно будет перебросить на страницу "СПАСИБО"
Важно: Если просто пользователь из любопытства нажмет на кнопку "ЗАБРОНИРОВАТЬ", то его не должно перебрасывать на
страницу спасибо. Его должно перебрасывать только в том случае, когда он введет номер телефона и нажмет "ЗАБРОНИРОВАТЬ"
Answer the question
In order to leave comments, you need to log in
Обработать событие нажатия кнопки — указать, на какую страницу редирект:
событие нажатия кнопки{
document.location.href = "thank-you.html";
}
А чтобы не было ложного редиректа, проверить заполнение поля. Если поле пусто, то не отправлять форму. Или сделать кнопку disable, пока не заполенено поле, чтобы она не нажималась.
Make a redirect in the backend part? This way you will be sure that the user will get to the "Thank you" page only after processing his data (in your situation, the data may go away, but there is no guarantee that it will be processed, and you will "say" thank you in vain).
HOW to do this depends on how you handle the form (component, bicycle) ?
Now in the template, the popup window is done like this:
Бронирование
<?
$APPLICATION->IncludeComponent(
"orion:ext.feedback.form",
"reservation",
array(
"AJAX_MODE" => "Y",
"AJAX_OPTION_ADDITIONAL" => $arItem["PROPERTIES"]["ARTICLE_FLAT"]["VALUE"],
"AJAX_OPTION_HISTORY" => "N",
"AJAX_OPTION_JUMP" => "Y",
"AJAX_OPTION_STYLE" => "Y",
"COMPONENT_ID" => "reservation-popup",
"COMPONENT_TEMPLATE" => "reservation",
"DATA-TABLE-COL1-WIDTH" => "100%",
"DATA-TABLE-COL2-WIDTH" => "0",
"DATA-TABLE-LABEL-ALIGN-H" => "l-align",
"DATA-TABLE-LABEL-ALIGN-V" => "c-valign",
"DATA-TABLE-WIDTH" => "100%",
"DEFAULT_INPUT_SIZE" => "30",
"DETAIL_TEXT_USE_HTML_EDITOR" => "N",
"EFBF_FORM_WIDTH" => "",
"ELEMENT_ASSOC" => "CREATED_BY",
"ERROR_MESSAGES_POSITION" => "UNDER",
"FIELD_ERRMSG" => "N",
"FIELD_ERROR_POSITION" => "N",
"FIELD_ORDER" => "N",
"FIELD_PREDEF" => "Y",
"FIELD_SELF_NAMES" => "Y",
"FIELD_VALID" => "Y",
"FORM_CODE" => "RESERVATION",
"FORM_NAME" => "",
"GROUPS" => array(
0 => "2",
),
"IBLOCK_ELEMENT_ID" => "",
"IBLOCK_ID" => "17",
"IBLOCK_TYPE" => "webforms",
"INPUT_AS_PASSWORD" => "",
"INPUT_AS_PASSWORD_CONFIRM" => "N",
"LIST_NOT_ESTABLISHED_PROP_STATUS" => "N",
"MAX_FILE_SIZE" => "0",
"MAX_LEVELS" => "100000",
"NEED_JQUERY" => "EXISTS_JQUERY",
"PREVIEW_TEXT_USE_HTML_EDITOR" => "N",
"PROPERTY_CODES" => array(
0 => "NAME",
1 => "PROP_SKU",
),
"PROPERTY_CODES_REQUIRED" => array(
0 => "NAME",
1 => "PROP_SKU",
),
"RESIZE_IMAGES" => "N",
"SAVE_TO_IB" => "Y",
"SEND_MESSAGE" => "Y",
"USER_MESSAGE_ADD" => "",
"USER_SEND_MESSAGE" => "N",
"USE_CAPTCHA" => "N",
"USE_CAPTCHA_REFRESH" => "N",
"USE_TEXT_FOR_HTML" => array(
),
"VALID_NAME" => "^(\\+?\\d{1}\\s?)?(\\d{10})\$",
"VALID_TAGS" => "",
"VALID_DATE_ACTIVE_FROM" => "",
"VALID_DATE_ACTIVE_TO" => "",
"VALID_IBLOCK_SECTION" => "",
"VALID_PREVIEW_TEXT" => "",
"VALID_PREVIEW_PICTURE" => "",
"VALID_DETAIL_TEXT" => "",
"VALID_DETAIL_PICTURE" => "",
"CUSTOM_TITLE_NAME" => "Телефон",
"CUSTOM_TITLE_TAGS" => "",
"CUSTOM_TITLE_DATE_ACTIVE_FROM" => "",
"CUSTOM_TITLE_DATE_ACTIVE_TO" => "",
"CUSTOM_TITLE_IBLOCK_SECTION" => "",
"CUSTOM_TITLE_PREVIEW_TEXT" => "",
"CUSTOM_TITLE_PREVIEW_PICTURE" => "",
"CUSTOM_TITLE_DETAIL_TEXT" => "",
"CUSTOM_TITLE_DETAIL_PICTURE" => "",
"CUSTOM_TITLE_PROP_STATUS" => "",
"CUSTOM_TITLE_CAPTCHA" => "",
"CUSTOM_TITLE_CAPTCHA_INPUT" => "",
"PREDEFINED_PROP_SKU" => "",
"PREDEFINED_PROP_STATUS" => "150",
"EMAIL_TO" => $strEmail,
"EVENT_MESSAGE_ID" => array(
0 => "27",
),
"CUSTOM_TITLE_PROP_SKU" => "",
"VALID_PROP_SKU" => "",
"PREDEFINED_NAME" => "+7",
"PREDEFINED_TAGS" => "",
"PREDEFINED_DATE_ACTIVE_FROM" => "",
"PREDEFINED_DATE_ACTIVE_TO" => "",
"PREDEFINED_IBLOCK_SECTION" => "",
"PREDEFINED_PREVIEW_TEXT" => "",
"PREDEFINED_PREVIEW_PICTURE" => "",
"PREDEFINED_DETAIL_TEXT" => "",
"PREDEFINED_DETAIL_PICTURE" => ""
),
false
);
?>
Here is the solution to my question
Everything turned out to be easy
@bot.message_handler(commands=['1'])
def handle_text (message):
bot.send_message(message.chat.id, "Введите данные")
@bot.message_handler(content_types=['text'])
def handle_text(message):
txt = message.text
print(txt)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question