Косые небоскрёбы
Jul. 24th, 2007 10:47 amПодглядел у
pajasu: Гугломап: 41.9N, 87,6W
![[livejournal.com profile]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)
<html><head>
<title>Examples → Text Field</title>
<style type="text/css">
.ex a:link, .ex a:visited {
text-decoration: none;
border-bottom: 1px dashed #666;
color: #666;
}
</style>
<script language="javascript">
function cp(obj) {
document.getElementById('what').value = obj.innerHTML;
} // function cp
</script>
</head>
<body>
<form><p>Search for <input type="text" name="what" id="what"></p>
<p class="ex">Examples:
<a href="#" onclick="cp(this); return false">apple</a>,
<a href="#" onclick="cp(this); return false">banana</a>,
<a href="#" onclick="cp(this); return false">cucumber</a></p>
</form>
</body></html>
А теперь пойдём на Яндекс, поглядим, как сделано у них.result
, но до вставки результата методом populate_from_widget
. Решается при помощи HTML::Widget::Result::add_valid:sub create_do : Local {
# SKIPPED
# Validate the form parameters
my $result = $w->process($c->req);
# Were their validation errors?
if ($result->has_errors) {
# SKIPPED
}
else {
# SKIPPED
# Меняем значение поля password
$result->add_valid('password', Digest::SHA1::sha1_hex($password));
# SKIPPED
my $user = $c->model('Dbase::User')->new()->populate_from_widget($result);
# SKIPPED
} # else без ошибок
# SKIPPED
} # sub create_do
$c->response->redirect($c->uri_for('some_url'));
Пришлось создать пустой файл с именем none
и в функции с редиректом добавить:$c->stash->{'template'} = 'none';
Как-то это неправильно...