Jump to content


autofill

grocery crud

  • Please log in to reply
4 replies to this topic

#1 dhoni223

dhoni223

    Member

  • Members
  • PipPip
  • 13 posts

Posted 15 February 2018 - 07:33 AM

i want to autofill some column based on id in add forum



#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 16 February 2018 - 03:53 AM

i am confused on the same - add form dose not have any id.. so how you plan to set values .,.and on what basis?



#3 dhoni223

dhoni223

    Member

  • Members
  • PipPip
  • 13 posts

Posted 22 February 2018 - 06:14 AM

i have one table with id and other table with price if i type id or select it from dropdown it should autofill the price field



#4 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 23 February 2018 - 05:10 AM

Steps to achieve the same:

 

1. Have to write a script in a JS file which will handle the on change event for the drop down (the source element)

2. In script - make Ajax call to retrieve the price based on the value of selected element.

3. Write a action in controller to retrieve and send back the price / output to the request

4. In the success function for the ajax call - set the value of the field with the element retrieved from the ajax request.

 

1 more important info - add the js in action using set_js function ...

and in the js - call for window.onload function and not $.ready - the $.ready will fail...

 

That's the way u do it..

 

Happy GCing :)



#5 dhoni223

dhoni223

    Member

  • Members
  • PipPip
  • 13 posts

Posted 23 February 2018 - 10:27 AM

thanks i ll try dis 

can u send any examples







Also tagged with one or more of these keywords: grocery crud

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users