Jquery dialog echo check content - jquery-ui

How to check echo dialog alert
if <div class="mydialog"></div> no dialog alert
else <div class="mydialog"> $Value-content </div> echo dialog alert $Value-content
Thanks

echo '<script type="text/javascript">'
, 'IF (' . $Value-content . ' != \"\")'
, 'Alert(' . $Value-content . ');'
, '</script>'
;

Related

sessionStorage is 1/2 working

pag1.php
<div id="guest_name"></div>
<?
//Some code
echo '<script>';
echo 'var guest_name = ' . json_encode($guest_name) . ';';
echo '</script>';
echo "<a href=main.php>Enter</a>";
?>
<script>
//This works great
$("#guest_name").text(sessionStorage.getItem("guest_name"));
</script>
when I click on and go to main.php, it stops working!!
<div id="guest_name"></div><!--Nothing is shown this div here -->
<script>
$("#guest_name").text(sessionStorage.getItem("guest_name")); //Does not work!!
</script>
main.php is NOT loaded in a new window or a new tab! Thank you

POST working wierdly in yii2

Below given is the code for my view
<div class="col-md-6">
<?php
if($fanclub_count<2)
{?>
<?php $form = ActiveForm::begin();?>
<?= $form->field($model_fanclub, 'crew_member_id')->dropDownList(ArrayHelper::map(MovieCrewMembers::find()->all(),
'id', 'name'),['prompt'=>'Select Crew','style'=>'width:50%']) ?>
<?= Html::submitButton(Yii::t('app', 'Join'),
['class' =>'btn btn-success']) ?>
<?php ActiveForm::end();
}?>
</div>
<div class="col-md-6">
<?php
if($user_clubs!=null)
{
foreach($user_clubs as $active_clubs )
{
$image= '/movie_crew_members/' . $active_clubs[0]."_".$active_clubs[2];
$path = \Yii::$app->thumbler->resize($image,55,55,Thumbler::METHOD_NOT_BOXED,true);
?>
<div class="col-md-6">
<img src="cache/<?php echo $path?>"></br>
<a href="<?php echo \Yii::$app->getUrlManager()->createUrl( [ '/users/change_fanclub',
'id'=>$active_clubs[0],'userid'=>$user_id] ); ?>">
<i class="fa fa-times-circle-o fa-2x"></i></a>
</div>
<?php
}
}
else
{
echo "No Active Clubs";
}
?>
</div>
there are basically two things a dropdown box and a image with a icon which redirect to a action. Sometimes it works perfect sometimes not. ie,when i click the drop down it gets redirected to users/change_fanclub. how is it possible? dropdown is independent of action users/change_fanclub. then how come it get redirected there?
I solved the problem by using this
<?php
$form = ActiveForm::begin( [
'method' => 'post',
'action' => [ "users/profile","user_id"=>$user_id ],
] );
?>
i don't know why i got redirected to users/change_fanclub when i click on the submit button of model_fanclub instead of going to users/profile. But i removed the error by specifying the action in ActiveForm.

PHP Simple HTML DOM parsing to get to elements inside a href

<div>
text1
</div>
<div>
text2
</div>
<div>
text3
</div>
hello,
i try to parse links in html code below."thread_title" tag has different numbers.but could not solve it
thanks
$html = new simple_html_dom();
$html->load($input);
foreach($html->find('a[id=thread_title_([^\"]*)]') as $link)
echo $link->outertext . '<br>';
$html = new simple_html_dom();
$html->load($input);
foreach($html->find('a[id^=thread_title]') as $link)
echo $link->outertext . '<br>';

comment with no spaces will destroy my table comment

$display = mysql_query("SELECT * FROM table_comment WHERE blogid=$theID ORDER BY comment_id DESC")or die(mysql_error());
echo "<table border='0' align='center' width='900px' style='margin-bottom:20px;margin-top:-20px;background-color:brown;border-top-left-radius:50px;border-top-right-radius:15px;border-bottom-left-radius:15px;border-bottom-right-radius:50px;'>";
while($r = mysql_fetch_array($display))
{
echo "<tr>";
echo "<td align='left' style='font-size:15px;padding-left:25px;color:PowderBlue'><b style='color:LightGreen'><i>".$r['post_name']."</b></i> said:</td>";
echo "<td align='right' style='font-size:15px;padding-right:25px;'><b style='color:Yellow'>".$r['Time']."</b>&nbsp <b style='color:Orange'>".$r['Date']."</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='justify' style='color:White;font-size:20px;padding-left:25px;'> ".$r['comment_area']."</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2' align='center' style='padding-right:25px;color:Yellow'>_______________________________________________________________________________________________________</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
I have this codes for my table comment, but when i try to comment spamming it over the opposite edge of the comment area, without spaces and when i hit the post button, there, some texts in my comment cannot be seen. my table is stretched far out of the original comment table. Someone can help me please?
You can use CSS to fix this problem.
HTML:
<div class="test">Thisisverylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongspamcomment</div>
CSS:
.test {
word-wrap: break-word;
overflow: hidden;
width:250px;}
Demo: http://jsfiddle.net/NkLuW/

JQuery Sortable\Serialize issue

I have a document that uses PHP to generate a list from a DB
$q = "SELECT * FROM display ORDER BY diplay_order ASC";
$r = #mysqli_query ($dbc, $q);
echo "<ul id='categoryorder'>";
while ($item = mysqli_fetch_array($r)) {
echo "<li><div id='" . $item['ad_type'] . "_" . $item['unique_id'] . "'>
<form name='remove' action='saveable.php' method='get'>
<input type='submit' value='remove' />
<input type='hidden' name='id' value='" . $item['unique_id'] . "'>
</form>" .$item['unique_id'] . "</div></li>";
}
echo "</ul>";
I have then made these sortable which works fine but I can't get the serialize to work and it just creates an empty array.
$(document).ready(function() {
$('ul#categoryorder').sortable({
update: function() {
var order = $("ul#categoryorder").sortable("serialize");
alert(order);
}
});
});
Then the alert box just comes up empty. I am very new to this and any help would be much appreciated.
You need to add id to <li> tag. Change this part of PHP code,
echo "<li id='" . $item['ad_type'] . "_" . $item['unique_id'] . "'><div><form name='remove' action='saveable.php' method='get'><input type='submit' value='remove' /><input type='hidden' name='id' value='" . $item['unique_id'] . "'></form>" .$item['unique_id'] . "</div></li>";
Added id to <li>.

Resources