Skip to main content
added 4 characters in body
Source Link
Robert Lindgren
  • 24.5k
  • 12
  • 53
  • 79

I have a text box that I'm trying to take the value from and pass it into a REST query as a filter parameter when the button is clicked. If I hard code a value into the REST query it retrieves the values as expected. If i try to pass the form field as a parameter, I get no results.

Form:

Lawson ID: <input type="text" id="LawsonID" >
<input type="button" value="Execute Query" onclick="LoadInfo();" >
  

REST Query:

"/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?$select=Title,Co_x002d_worker_x0020_Last_x0020,Co_x002d_worker_x0020_First_x002,Status,Status_x0020_Reason,Leave_x0020__x0023_,First_x0020_Day_x0020_of_x0020_W,Initial_x0020_Call_x002f_Contact,Restrictions_x0020_and_x002f_or_&$filter=(Title eq + 'LawsonID' + )&$top=5000"

I have a text box that I'm trying to take the value from and pass it into a REST query as a filter parameter when the button is clicked. If I hard code a value into the REST query it retrieves the values as expected. If i try to pass the form field as a parameter, I get no results.

Form:

Lawson ID: <input type="text" id="LawsonID" >
 

REST Query:

"/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?$select=Title,Co_x002d_worker_x0020_Last_x0020,Co_x002d_worker_x0020_First_x002,Status,Status_x0020_Reason,Leave_x0020__x0023_,First_x0020_Day_x0020_of_x0020_W,Initial_x0020_Call_x002f_Contact,Restrictions_x0020_and_x002f_or_&$filter=(Title eq + 'LawsonID' + )&$top=5000"

I have a text box that I'm trying to take the value from and pass it into a REST query as a filter parameter when the button is clicked. If I hard code a value into the REST query it retrieves the values as expected. If i try to pass the form field as a parameter, I get no results.

Form:

Lawson ID: <input type="text" id="LawsonID" >
<input type="button" value="Execute Query" onclick="LoadInfo();" >
 

REST Query:

"/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?$select=Title,Co_x002d_worker_x0020_Last_x0020,Co_x002d_worker_x0020_First_x002,Status,Status_x0020_Reason,Leave_x0020__x0023_,First_x0020_Day_x0020_of_x0020_W,Initial_x0020_Call_x002f_Contact,Restrictions_x0020_and_x002f_or_&$filter=(Title eq + 'LawsonID' + )&$top=5000"
Source Link
Jason
  • 583
  • 1
  • 7
  • 27

Passing filter value to REST Query

I have a text box that I'm trying to take the value from and pass it into a REST query as a filter parameter when the button is clicked. If I hard code a value into the REST query it retrieves the values as expected. If i try to pass the form field as a parameter, I get no results.

Form:

Lawson ID: <input type="text" id="LawsonID" >

REST Query:

"/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?/_api/Web/Lists/GetByTitle('Lv%20Inquiries')/items?$select=Title,Co_x002d_worker_x0020_Last_x0020,Co_x002d_worker_x0020_First_x002,Status,Status_x0020_Reason,Leave_x0020__x0023_,First_x0020_Day_x0020_of_x0020_W,Initial_x0020_Call_x002f_Contact,Restrictions_x0020_and_x002f_or_&$filter=(Title eq + 'LawsonID' + )&$top=5000"