Why is different web-based behaviour on different pages



  • There's a form: введите сюда описание изображения One page, you get a phone and you click on the "send" button. There's a window of "Zaya's opted for success." Page two, action is the same, but there's a window in which the entire site is included.

      <div style="margin-left: 18px; margin-top: 4px;">
                     <div id="call_show" class="css_popup btn btn-warning" style="text-decoration:underline">
                      <a>
                             <img src="/img_new/phone_icon.png" height="16" width="13" alt="">
                             <span style="font-size: 12px; color: #999999; position: relative; top: -3px;">Позвоните мне</span>
                       </a>
                       </div>
    
              &lt;/div&gt;
    

    <?CJSCore::Init(array("popup", "jquery", "ajax"));?>
    <script>
    BX.ready(function(){
    var oPopup = new BX.PopupWindow('callback-popup', window.body, {
    autoHide : true,
    offsetTop : 1,
    offsetLeft : 0,
    lightShadow : true,
    closeIcon : true,
    closeByEsc : true,
    overlay: {
    backgroundColor: 'black', opacity: '80'
    }
    });

    oPopup.setContent(BX('request_call'));

    BX.bindDelegate(
    document.body, 'click', {className: 'css_popup' },
    BX.proxy(function(e){
    if(!e)
    e = window.event;
    oPopup.show();
    return BX.PreventDefault(e);
    }, oPopup)
    );
    });
    </script>

    <div id="request_call">
    <?$APPLICATION->IncludeComponent(
    "bitrix:form.result.new",
    "form_call_me",
    Array(
    "AJAX_MODE" => "Y",
    "AJAX_OPTION_HISTORY" => "N",
    "AJAX_OPTION_JUMP" => "N",
    "AJAX_OPTION_SHADOW" => "N",
    "AJAX_OPTION_STYLE" => "Y",
    "CACHE_TIME" => "3600",
    "CACHE_TYPE" => "A",
    "CHAIN_ITEM_LINK" => "",
    "CHAIN_ITEM_TEXT" => "",
    "EDIT_URL" => "",
    "IGNORE_CUSTOM_TEMPLATE" => "N",
    "LIST_URL" => "",
    "SEF_MODE" => "N",
    "SUCCESS_URL" => "",
    "USE_EXTENDED_ERRORS" => "Y",
    "VARIABLE_ALIASES" => array("WEB_FORM_ID"=>"WEB_FORM_ID","RESULT_ID"=>"RESULT_ID",),
    "WEB_FORM_ID" => "26"
    )
    );?>
    </div>

    Component

    <?
    if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
    ?>

    <div class="callback-popup">
    <div class="callback-popup-content_default">
    <?/* ?>
    <div class="callback-popup-content_success">
    <?=$arResult["FORM_NOTE"]?>
    </div>
    <? */?>
    <?if ($arResult["isFormNote"] == "Y"){?>
    <div class="success"><?=GetMessage('FORM_SEND_SUCCESS')?></div>
    <?}else{?>
    <?=$arResult["FORM_HEADER"]?>
    <?if($arResult["isFormTitle"]){?><h3><?=$arResult["FORM_TITLE"]?></h3><?}?>
    <?if ($arResult["isFormErrors"] == "Y"):?><p class="callback-errors"><?=$arResult["FORM_ERRORS_TEXT"];?></p><?endif;?>
    <table class="data-table">
    <tbody>
    <?
    foreach ($arResult["QUESTIONS"] as $FIELD_SID => $arQuestion)
    {
    if ($arQuestion['STRUCTURE'][0]['FIELD_TYPE'] == 'hidden')
    {
    echo $arQuestion["HTML_CODE"];
    }
    else
    {
    ?>
    <tr>
    <td width="200px">
    <?if (is_array($arResult["FORM_ERRORS"]) && array_key_exists($FIELD_SID, $arResult['FORM_ERRORS'])):?>
    <span title="<?=$arResult["FORM_ERRORS"][$FIELD_SID]?>"></span>
    <?endif;?>
    <?=$arQuestion["CAPTION"]?><?if ($arQuestion["REQUIRED"] == "Y"):?><?=$arResult["REQUIRED_SIGN"];?><?endif;?>
    <?=$arQuestion["IS_INPUT_CAPTION_IMAGE"] == "Y" ? "<br />".$arQuestion["IMAGE"]["HTML_CODE"] : ""?>
    </td>
    <td class="<?=$FIELD_SID?>"><?=$arQuestion["HTML_CODE"]?></td>
    </tr>
    <?
    }
    } //endwhile
    ?>
    </tbody>
    <tfoot>
    <tr>
    <th colspan="2" align="center">
    <button <?=(intval($arResult["F_RIGHT"]) < 10 ? "disabled="disabled"" : "");?> class="button bt3" type="submit" name="web_form_submit" value="<?=htmlspecialcharsbx(strlen(trim($arResult["arForm"]["BUTTON"])) <= 0 ? GetMessage("FORM_ADD") : $arResult["arForm"]["BUTTON"]);?>">
    <span><?=htmlspecialcharsbx(strlen(trim($arResult["arForm"]["BUTTON"])) <= 0 ? GetMessage("FORM_ADD") : $arResult["arForm"]["BUTTON"]);?></span>
    </button>
    </th>
    </tr>
    </tfoot>
    </table>
    <p>
    <?=$arResult["REQUIRED_SIGN"];?> - <?=GetMessage("FORM_REQUIRED_FIELDS")?>
    </p>
    <?=$arResult["FORM_FOOTER"]?>
    <?
    } //endif (isFormNote)
    ?>
    </div>
    </div>

    and the code in this component of component_epilog.php

    <?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
    <?$bxajaxid = CAjax::GetComponentID($component->__name, $component->__template->_name);?>
    <style>#wait_comp
    <?=$bxajaxid?>{display: none !important;}</style>

    <script>

    $(document).ready(function() {
    $('form[name = CALL_ME]').submit(function(){
    return formOrderCheck(this);
    });

       $('.PHONE input[type=text]').mask('+9(999)999-99-99');
    

    });

    function formOrderCheck(form)
    {
    var success = true;
    var phone = $(form).find('.PHONE input[type = text]');

    if(!$(phone).val())
    {
        $(phone).parent('td').addClass('error');
        success = false;
    }
    else
        $(phone).parent('td').removeClass('error');
    
    return success;
    

    }

    </script>

    UPD:
    I' looking at a page where there's a Pope error in the consoles. введите сюда описание изображения



  • If there's a window in which the site code returns, that's the answer to the server, look at the code that responds to the button.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2