Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "PhilWynn"

Thank you.

All is good. I didn't realise that default values were not persisted.

Hi,

I could really do with an answer on this issue. Please could you let me know if there is a way around this.

Thank you

Thank you. Managed to find a solution using a custom repository.

Hi,

Just wondering if you have been able to look into this yet?

Hi,

This issue is very easy to reproduce on the initial az code, e.g. creating a User:

  • Remove the 'required' attribute from a field in _CreateOrEditModal.cshtml
  • Fill in the form, leaving this field empty
  • On save, validation message comes from server
  • Now edit _CreateOrEditModal.js 'save' so that the call to userService uses abp.message.confirm
  • On save, no validation message from the server

Yes, the validation error appears in the console as expected. No javascript errors are reported. Another interesting thing to note is when I apply the following error handler:

function _attachCloseEvent() {
            _modalManager.getModal().find('.issue-close').click(function (e) {
                e.preventDefault();
                if (!_closeIssueForm.valid()) {
                    return;
                }
                abp.message.confirm(
                    app.localize('IssueCloseWarningMessage'),
                    function (isConfirmed) {
                        if (isConfirmed) {                            
                            _modalManager.setBusy(true);
                            var issue = _closeIssueForm.serializeFormToObject();
                            abp.ajax({
                                url: abp.appPath + 'Mpa/Issues/CloseIssue',
                                data: JSON.stringify({
                                    issueOutput: issue
                                }),
                                success: function () {                                    
                                    abp.notify.success(app.localize('IssueSuccessfullyClosed'));
                                    _modalManager.close();
                                    abp.event.trigger('app.itemSaved');
                                },
                                error: function () {
                                    alert('error');
                                },
                                always: (function() {
                                    _modalManager.setBusy(false);
                                })
                            });
                        }
                    }
                );
            });
        }

In this case, the validation dialog appear correctly while the alert box is shown, but when I dismiss the alert box the validation dialog disappears.

Answer

Hi,

I am not really sure how that post will help me with my current issue. I need to present the localized value of an enum on a modal form. The code I have is as follows:

public enum ProcessingType
    {
        [Display(Name = "Standard")]
        Standard = 1,
        [Display(Name = "Off cycle")]
        OffCycle = 2,
        [Display(Name = "End of year")]
        EndOfYear = 3
    }

public class HeadlineTaskDto
{
        ...
        public ProcessingType ProcessingType { get; set; }
       ...
}

public static class EnumExtensions
    {
        public static string GetDisplayName(this Enum enumValue)
        {
            return enumValue.GetType()
                            .GetMember(enumValue.ToString())
                            .First()
                            .GetCustomAttribute<DisplayAttribute>()
                            .GetName();
        }
    }

...
<div class="col-md-3">
        <div class="form-group form-md-line-input form-md-floating-label">
             <div class="form-control form-control-static">@Model.Task.ProcessingType.GetDisplayName()</div>
                <label>Type</label>
        </div>
</div>
...

I'm not sure how a client side constant would help me here?

Answer

Fantastic. Thanks for the help..

Answer

Thanks, that was what I was looking for.

Is the javascript API documented anywhere?

Showing 61 to 70 of 75 entries