django-bootstrap-modal-forms icon indicating copy to clipboard operation
django-bootstrap-modal-forms copied to clipboard

how to locate asyncSettings.successMessage in the code ?

Open aathlan opened this issue 3 years ago • 1 comments

I would like to locate asyncSettings.successMessage below the {% endfor %} in the modal-body div of my modal. When I click on update, I would like to display a message in the div of class "modal_success". But the asyncSettings.successMessage variable is a string variable and can be located only on the body tag of my html according to the js and not in an other tag with specific class or id.

This is my code, for example update_book.html :

<div class="modal-body">
    <div class="{% if form.non_field_errors %}invalid{% endif %} mb-2">
      {% for error in form.non_field_errors %}
      {{ error }}
      {% endfor %}
    </div>

    {% for field in form %}
    <div class="form-group">
      <label for="{{ field.id_for_label }}">{{ field.label }}</label>
      {% render_field field class="form-control" placeholder=field.label %}
      <div class="{% if field.errors %} invalid{% endif %}">
        {% for error in field.errors %}
        <p class="help-block">{{ error }}</p>
        {% endfor %}
      </div>
    </div>
    {% endfor %}
    <div id='modal_success' class= 'alert alert-success' role='alert'> </div>
  </div>


  <div class="modal-footer">
    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
    <button type="submit" class="btn btn-primary">Update</button>
  </div>

</form>

Or can I proceed to locate the asyncSettings.successMessage in the div with modal_success for class ?

Thank you.

aathlan avatar Sep 14 '21 11:09 aathlan

@aathlan As you already found out the message is always prepended to the body when asyncSetting is used. This is a great idea for enhancement, since it extends the options for the user. I'll tag this proposal with enhancement and high priority labels.

Of course you're invited to submit PR if you feel confident to implement this. Unfortunately I can't define my timeline, but I'll do my best to start working on this package again. Summer is almost over and autumn is definitely more appropriate time to be bound to the screen.

trco avatar Sep 14 '21 18:09 trco