Niyaz

Experience

230

0 Best Reply Awards

  • Member Since 1 Week Ago
  • 0 Lessons Completed
  • 0 Favorites

21st June, 2018

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 day ago

I tried this

$('input[name="community_id"],input[name="category_of_works"]').change(function () { 
    var community = $('input[name="community_id"]').val();
    var category = $('input[name="category_of_works"]').val();
    var secdepo ;

    if (community == 2 && category == 0) {
             secdepo ='<li>A refundable security deposit of AED 500.00 </li>'
      } else {
        secdepo = '<li>A refundable security deposit of AED 5,000.00 </li>'
       }
        $('#secdepo').empty().append(secdepo);
});

and in my blade

<label class="col-xs-3 control-label">Terms and Conditions</label> 
                            <div class="col-xs-9">
                                <div class="agree-terms">  
<ul>
<div id="secdepo"></div>
<li>I understand xxxxxxxxxxxxxx.</li>
                                        <li>I confirm that xxxxxxxxxxxxxxxxxxxxxx</li>
                                        <li>I confirm that xxxxxxxxxxxxxx.</li>
 </ul>
                                </div>
                            </div>

but still didn't get it

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 day ago

Tried but didn't get the line in terms and condition

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 day ago

Also console.log will help me whether it is running or not please tell me how to do that to?

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 day ago

Yes, there is no error But i don't find any changed in my agree-terms (class) I changed some of the code as per my wish as

jQuery('input[name="community_id",input[name="category_of_works"]').change(function(){
 
var $community = jQuery('input[name="community_id"]');
var $category = jQuery('input[name="category_of_works"]');
var $secdepo = jQuery('#sec-depo')

if($community.val() == 2 && $category.val() == 0) {
  if(secdepo.length == 0){
    jQuery('.agree-terms ul').append('<li id="sec-depo">A refundable security deposit of AED 500.00.</li>')
  } 
} else {
   $('.agree-terms ul').append('<li id="sec-depo">A refundable security deposit of AED 5,000.00 .</li>')
}
});

I used id instead of class Is there any error

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 day ago

Hi

I am getting an error after trying the code on my console as

jquery is not defined

i tried in many ways to solve it but cannot find the solution

20th June, 2018

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 2 days ago

Sorry since i'm new to php. I'm asking a hell lots of questions to you? Hope i will get used to php

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 2 days ago

Also i can clearly understand your code But cannot understand this

if ($hugeDepo.length == 0) {

where does the "length" comes from

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 2 days ago

@yorki Thank you for your reply .. :)

I have three doubt :

  1. should i have to put it into a function and trigger as onchange or as simply like your code
  2. can i use "$" instead of "jquery" , because i used it perviousely
  3. will this code will effect my previous code since i have used it as a separate code and trigger by onchange function in my select option

Please give me a better idea

Niyaz started a new conversation How To Implement Different Condition For Different Dropdown In Form • 2 days ago

Hi, i am doing a project in laravel which i need implement different condition for different dropdown (select option) Like , this is my 1st dropdown list option

{{ Form::select('category_of_works', ['0' => 'Minor Works', '1' => 'Major Works'], null , ['class' => 'form_control'])  }}

and this is my 2nd dropdown list option

{{ Form::select('community_id',[ '1' => 'Project1', '2' => 'Project2', '3' => 'Project3' , '4' => 'Project4'],null ,['class' => 'form-control'] ) }}

My query is if i select "minor works" from 1st dropdown and "Project2" from 2nd dropdown i have to get a sentence like "Your deposit is huge" in my terms and condition

And my Terms and condition is

<label class="col-xs-3 control-label">Terms and Conditions</label> 
                            <div class="col-xs-9">
                                <div class="agree-terms">  
<ul>
<li>I understand xxxxxxxxxxxxxx.</li>
                                        <li>I confirm that xxxxxxxxxxxxxxxxxxxxxx</li>
                                        <li>I confirm that xxxxxxxxxxxxxx.</li>
 </ul>
                                </div>
                            </div>

Perviously, i have similar condition for one dropdown and i did it by javascript and query . But now i have it for 2 dropdown and i dont know how to proceed it.

Can anyone help me to solve it as i can do it by query or by laravel( php) ?

18th June, 2018

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 4 days ago

@mvd

Thank you very much for your help All my requriements is working

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 4 days ago

Yes @mvd ,

i did as per your code used switch, case, breaks in every line

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 4 days ago

Hi

I tried using the controller

$statusInfo = array(
            1 => 'Re-activation',
            2 => 'Re-activation, Additional access',
            3 => 'Re-activation, Additional access, Lost',
            4 => 'Re-activation, Additional access, Lost, Damaged',
            5 => 'Re-activation, Additional Access, Lost, Damaged, Replacement'
         );

and on my blade


@foreach( $request->request_status as $status)
               @if (isset($statusInfo[$status]))
               {{ $statusInfo[$status] }}
             @else
               None of them is selected
            @endif
            @endforeach 

But my output is

Reason For Request:
 None of them is selected None of them is selected None of them is selected

It displays 3 times "None of them selected" instead of values

And this is my database table and their column is

  id            Name                      request_status

  1              niyaz                        ["1","2","3"]

Have to retrieve the values of "request_status"(column) into my blade template in the name as mention above.

And last but not the least , those values("1,2,3") are my checkbox value

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 4 days ago

Hi @mvd ,

I tried your code of using switch in my blade And got the output as :

 Reason For Request :
 @switch ($status) @case(5) Re-activation, Additional Access, Lost, Damaged, Replacement

Instead of only displaying Reactivation,Additional Access, Lost, Damaged, Replacement

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 4 days ago

Hi @mvd ,

I tried your code of using switch in my blade And got the output as :

''' Reason For Request : @switch ($status) @case(5) Re-activation, Additional Access, Lost, Damaged, Replacement

''' Instead of only displaying Reactivation,Additional Access, Lost, Damaged, Replacement

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 4 days ago

Thank you for the replies since i'm new to laravel .And i have an another query like can i have if condition to print different item

Here is my code

Reason For Request @foreach( $request->request_status as $status) @if ($status == 1 && $status == 2 && $status == 3 && $status == 4 && $status == 5) Re-activation, Additional Access, Lost, Damaged, Replacement @elseif ($status == 1 && $status == 2 && $status == 3 && $status == 4) Re-activation, Additional access, Lost, Damaged @elseif ($status == 1 && $status == 2 && $status == 3) Re-activation, Additional access, Lost @elseif ($status == 1 && $status == 2) Re-activation, Additional access @elseif ($status == 1) Re-activation @else None of them is selected @endif @endforeach Please re-correct and provide me a better solution Thank you

14th June, 2018

Niyaz started a new conversation To Retrieve The Array Value From Database To My View Blade • 1 week ago

array:13 [▼ "_token" => "K5eGLUL5zZDaemAKZljf2FuA44Qxb1oA8yqnxbWX" "community_id" => "1" "name" => "nias" "building_no" => "54" "unit_no" => "" "mobile" => "984" "email" => "" "request_status" => array:4 [▼ 0 => "1" 1 => "2" 2 => "3" 3 => "4" ] "vehicle_one" => "" "registration_one" => "" "vehicle_two" => "" "registration_two" => "" "agree" => "agree" ]

Here is my input from my form and I need to get the values of the array in the name "request_status" from the database to my view blade how to get it? anyone knows about it

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.