CMS форма не отображается правильно для CSS - PullRequest
0 голосов
/ 06 июля 2010

Я использую систему CMS, в которой есть шаблон для создания форм с предопределенным CSS.

Используемый CSS-файл здесь

Форма, которую я сейчас использую:

<div class="bodyline">
    <?php $theform->startForm($pageTitle)?>

    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="report">Report</label></legend>
            <p>
                <?php $theform->showField("towel")?>
            </p>
        </fieldset>
    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="name">Info</label></legend>

            <p class="big"><?php $theform->showField("firstname"); ?></p>
            <p class="big"><?php $theform->showField("lastname"); ?></p>
            <p class="big"><?php $theform->showField("country"); ?></p>
            <p class="big"><?php $theform->showField("passport"); ?></p>
            <p class="big"><?php $theform->showField("email"); ?></p>
            <p class="big"><?php $theform->showField("roomnumber"); ?></p>
            <p class="big"><?php $theform->showField("hostel"); ?></p>
            <p class="big"><?php $theform->showField("checkin"); ?></p>
            <p class="big"><?php $theform->showField("checkout"); ?></p>
            <p class="big"><?php $theform->showField("locker"); ?></p>
            <p class="big"><?php $theform->showField("towel"); ?></p>
            <p class="big"><?php $theform->showField("tabno"); ?></p>

        </fieldset>

    </div>

</div>

Теоретически это должно показывать поле слева и поле справа. Вместо этого rightSideDiv отображается либо выше, либо ниже leftSideDiv, занимая всю ширину формы.

Результирующий HTML-код

<form action="/1/phpbms/modules/micro%20hospitality/guests_addedit.php?id=1" method="post" name="record" onsubmit="return validateForm(this);"><div id="dontSubmit"><input value=" " onclick="return false;" type="submit"></div>        <div id="topButtons"><div class="saveCancels"><input accesskey="s" title="Save (alt+s)" id="saveButton1" name="command" value="save" class="Buttons" type="submit"><input id="cancelButton1" name="command" value="cancel" class="Buttons" onclick="this.form.cancelclick.value=true;" accesskey="x" title="(access key+x)" type="submit"></div></div>
        <h1 id="h1Title"><span>Guests</span></h1>
    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="report">Report</label></legend>
            <p>
                <input id="towel" name="towel" value="1" class="radiochecks" type="checkbox"> <label id="towelLabel" for="towel">Towel</label>          </p>

        </fieldset>
    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="name">Info</label></legend>

            <p class="big"><label for="firstname" class="important">First Name</label><br><input id="firstname" name="firstname" value="Jason" size="32" maxlength="64" class="important" type="text"></p>

        </fieldset>

    </div>

        </form>

Теперь включенные формы работают нормально, и я не могу понять, почему.

Включенный код формы для работающей страницы:

<div class="bodyline">
    <?php $theform->startForm($pageTitle)?>

    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="importance">importance / privacy</label></legend>
            <p>
                <?php $theform->showField("importance")?>
                <?php $theform->showField("private")?>
            </p>
        </fieldset>
    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="content">memo</label></legend>
            <p id="timeStampP">
                <button id="timeStampButton" type="button" class="graphicButtons buttonTimeStamp" accesskey="t" title="Add time stamp to memo (Access Key - t)">time stamp</button>
            </p>
            <p>
                <textarea name="content" cols="45" rows="23" id="content"><?php echo htmlQuotes($therecord["content"])?></textarea>
                <input id = "username" type="hidden" value="<?php echo formatVariable(trim($_SESSION["userinfo"]["firstname"]." ".$_SESSION["userinfo"]["lastname"]))?>" />
            </p>
        </fieldset>
    </div>

</div>

и результирующий HTML

<form action="/1/phpbms/modules/base/notes_addedit1.php" method="post" name="record" onsubmit="return submitForm(this)" id="record"><div id="dontSubmit"><input value=" " onclick="return false;" type="submit"></div>        <div id="topButtons"><div class="saveCancels"><input accesskey="s" title="Save (alt+s)" id="saveButton1" name="command" value="save" class="Buttons" type="submit"><input id="cancelButton1" name="command" value="cancel" class="Buttons" onclick="this.form.cancelclick.value=true;" accesskey="x" title="(access key+x)" type="submit"></div></div>
        <h1 id="h1Title"><span>Note/Task/Event</span></h1>

    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="importance">importance / privacy</label></legend>
            <p>
                <select name="importance" id="importance"> <option value="3">Highest</option>

<option value="2">High</option>
<option value="1">Medium</option>
<option value="0" selected="selected">Normal</option>
<option value="-1">Low</option>
<option value="-2">Lowest</option>
</select>
                        <input id="private" name="private" value="1" class="radiochecks" checked="checked" type="checkbox"> <label id="privateLabel" for="private">private</label>          </p>
        </fieldset>

    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="content">memo</label></legend>
            <p id="timeStampP">
                <button id="timeStampButton" type="button" class="graphicButtons buttonTimeStamp" accesskey="t" title="Add time stamp to memo (Access Key - t)">time stamp</button>
            </p>

            <p>
                <textarea name="content" cols="45" rows="23" id="content"></textarea>
                <input id="username" value="Administrator" type="hidden">
            </p>
        </fieldset>
    </div>

        </form>

Есть ли какая-либо причина для поведения, которое я описал?

1 Ответ

0 голосов
/ 06 июля 2010

leftSideDiv не имеет float. Либо переопределите его в CSS, либо установите его как встроенный стиль:

float:left

http://phpbms.org/browser/trunk/phpbms/common/stylesheet/mozilla/pages/base/notes.css#L26

Он также будет нуждаться в ширине, в зависимости от ширины ваших контейнеров. Это может помочь:

http://www.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...