Question

I am using Jquery Token-Input for autosearch field. I need to send PropertyToSearch field value dynamically.

HTML:

   <input checked="checked" name="suggest" type="radio" />Month
   <input name="suggest" type="radio" />Day</label>

As in the above html fields.

When i select Month, the list should be listed as Months and When i select Day, the list should be listed as week days.

Now i am passing propertyToSearch in default like below,

SCRIPT:

         $("#demo").tokenInput(../Management/getDaysAndMonths,
            {
                propertyToSearch: "Month",
                tokenLimit: 1
            });

How i need to set propertyToSearch field value dynamically. so that it can switch the listed values based on the selected radio button field.

please clarify me through suggestions.

thanks in Advance.

Était-ce utile?

La solution 2

I got a solution.

Instead of changing the propertyToSearch. I simply changed the code behind to list the values based on the input provided.

So, if month is selected. I pass a parameter "searchProperty" in url as month and if day has been selected I pass a parameter as day based on the searchProperty value. I list the values and pass it on the dropdown list.

     $("#demo").tokenInput("../Management/getDaysAndMonths?searchProperty="+$('input[name="suggest"]').val(),
       {
           //code
       });

Autres conseils

use jquery selecot rto select the value...

$('input[name="suggest"]').val()
  -^^^^^^^^^^^^^^^^^^^^^^--selects input with name=suggest and .val() selects the selected radio value.

try this

HTML

<input checked="checked" name="suggest" type="radio" value="Month"/>Month
<input name="suggest" type="radio" value="Day"/>Day</label>

JQUERY

 $("#demo").tokenInput(../Management/getDaysAndMonths,
  {
     propertyToSearch:$('input[name="suggest"]').val(),
     tokenLimit: 1
  });
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top