https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:25 PM
    Primary Key. A number representing the entry in the database table
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:26 PM
    object.pk
  • a

    ancient-father-3063

    06/28/2022, 12:27 PM
    but these are form fields, they're not in my database?
  • a

    ancient-father-3063

    06/28/2022, 12:28 PM
    I was told those might/will be in the next version but they're not live yet.
  • a

    ancient-father-3063

    06/28/2022, 12:32 PM
    sorry, if you have the time I'm still not understanding how these form field ids are related to a pk
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:35 PM
    Depends on your usecase. Creating forms from a model is a very common thing. So that is why i assumed you do just that. Actually very uncommon NOT to do that
  • a

    ancient-father-3063

    06/28/2022, 12:36 PM
    it is from a model
  • a

    ancient-father-3063

    06/28/2022, 12:36 PM
    it's a django modelForm
  • a

    ancient-father-3063

    06/28/2022, 12:37 PM
    but my understanding is that the object is not in the database until the form is saved?
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:39 PM
    Not entirely sure what you are trying to do. User is filling out a form and you need it to do validation?
  • a

    ancient-father-3063

    06/28/2022, 12:39 PM
    I thought we were talking about how to set the id of a form element programatically
  • a

    ancient-father-3063

    06/28/2022, 12:40 PM
    but these are just empty forms (before the user fills them out)
  • a

    ancient-father-3063

    06/28/2022, 12:40 PM
    they're empty model forms.
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:42 PM
    so you just want to generate some numbers as a reference? Otherwise you can look up the foeld "later" in the backend at several points in time.
  • a

    ancient-father-3063

    06/28/2022, 12:42 PM
    I'm pretty new at this
  • a

    ancient-father-3063

    06/28/2022, 12:42 PM
    so I'm just not understanding
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:44 PM
    Could just pass whatever you need as "context". Or use custom template tags. Or anything else via jinja methods
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:45 PM
    Just pick one ^^
  • b

    brave-dog-98297

    06/28/2022, 12:45 PM
    if the data for your select comes from your backend ie render(request, 'html_page', {context}), you will have id/pk within the context data you have sent to the html render. but if you manually enter the data on the html page for the select fields there will be no id/pk
  • m

    mysterious-toddler-20573

    06/28/2022, 12:50 PM
    correct, if you are willing to use the current htmx.js file in the
    dev
    branch, you have access to
    next td
    and so forth
  • a

    ancient-father-3063

    06/28/2022, 12:52 PM
    I think I'm willing I was just intimidated last time. Could you link me that again?
  • m

    mysterious-toddler-20573

    06/28/2022, 12:53 PM
    https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/htmx.js
  • m

    mysterious-toddler-20573

    06/28/2022, 12:53 PM
    download locally
  • m

    mysterious-toddler-20573

    06/28/2022, 12:53 PM
    I hope to release the next version of htmx and hyperscript next week, so you can update then
  • c

    cuddly-raincoat-38596

    06/28/2022, 12:54 PM

    https://youtu.be/KVq_DjIfnBo?t=1861▾

  • a

    ancient-father-3063

    06/28/2022, 12:56 PM
    oh that's great news; even if I can't get it to work I can wait a week.
  • a

    ancient-father-3063

    06/28/2022, 12:57 PM
    but I'll try it now
  • a

    ancient-father-3063

    06/28/2022, 12:57 PM
    usually I just link it in my header, so I'll have to figure that out
  • c

    cuddly-raincoat-38596

    06/28/2022, 1:01 PM
    https://www.programcreek.com/python/example/95859/crispy_forms.helper.FormHelper
  • c

    cuddly-raincoat-38596

    06/28/2022, 1:01 PM
    worst case you generate it yourself via form helper
1...725726727...1146Latest