Form errors from modal should be handled in modal

Bug #943518 reported by andrewsben on 2012-02-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Medium
Gabriel Hurley

Bug Description

Don't know if this is done on purpose or not, but it is functional so I guess this would be a UX improvement thing...

If while launching an instance I don't include a required field, such as server name, the form redirects to a launch page instead of staying on the images page with the popup.

Steps:
Goto images page
select desired image and click launch.
hit submit without putting a server name
redirects to URL/nova/images_and_snapshots/IMAGE_ID/launch/

Expected / Desired:
Stay on the same page keeping the nice look and refreshing the popup dialogue.

Changed in horizon:
assignee: nobody → Emma Grace Steimann (emmasteimann)
Devin Carlen (devcamcar) on 2012-03-02
Changed in horizon:
status: New → Confirmed
importance: Undecided → Low
milestone: none → essex-rc1
Tres Henry (tres) on 2012-03-09
Changed in horizon:
milestone: essex-rc1 → none

Hi,

I fixed this bug(943518).The changes are as follows.

In /horizon/horizon/horizon/dashboards/nova/templates/nova/images_and_snapshots/images/_launch.html file, we included one javascript that verifies whether server name field is empty or not.

If the field is empty, an error message is displayed stating that "Server Name field should not be empty". Textbox border will become "Red" color and background will become "Yellow".

Please let me know if anybody started working on this bug. If the work is not yet started on this bug, I will assign this bug to myself and check-in the code into repository.

The Java script is:

<script type="text/javascript">
function check()
{
var textBoxField = launch_image_form.id_name;
var errlabel=document.getElementById('error');
if(textBoxField.value == "")
{
        errlabel.innerHTML = "Error : Server Name field can't be empty.";
        launch_image_form.id_name.style.border = "solid 1px red";
        launch_image_form.id_name.style.background = "yellow"
        return false;
}
else
{
        return true;
}
}
</script>

Thanks and Regards,
Anil.

Andy Chong (andycjw) wrote :

this should be fixed in a generic way, e.g. a modal form handler in modal.js that submit form and replace the form in-place if the form submission failed, i would like to assign this to myself if emma is not working on it

Andy Chong (andycjw) on 2012-03-14
Changed in horizon:
assignee: Emma Grace Steimann (emmasteimann) → Andy Chong (andycjw)

Fix proposed to branch: master
Review: https://review.openstack.org/5312

Changed in horizon:
status: Confirmed → In Progress
Devin Carlen (devcamcar) on 2012-03-15
tags: added: essex-rc-potential

Doing a full pass at modal form validation is out-of-scope for essex at this point.

tags: removed: essex-rc-potential
Changed in horizon:
assignee: Andy Chong (andycjw) → Gabriel Hurley (gabriel-hurley)
Gabriel Hurley (gabriel-hurley) wrote :

After a good deal of discussion, several of the horizon core team have decided we will support a basic degree of form handling to refresh error'd forms into the modal for Essex.

Further development beyond that will be tracked by this blueprint: https://blueprints.launchpad.net/horizon/+spec/global-ajax-communication

tags: added: essex-rc-potential
summary: - launch instance without required field redirects to launch instance page
- instead of refreshing popup
+ Form errors from modal should be handled in modal
Changed in horizon:
importance: Low → Medium

Reviewed: https://review.openstack.org/5312
Committed: http://github.com/openstack/horizon/commit/c11cd9d1c5a4cfcc0120b5ab75564ef1d2df15f6
Submitter: Jenkins
Branch: master

commit c11cd9d1c5a4cfcc0120b5ab75564ef1d2df15f6
Author: Gabriel Hurley <email address hidden>
Date: Wed Mar 21 16:14:59 2012 -0700

    Implements AJAX form posting.

    This is somewhat of a hack for Essex, since the long-term solution
    is a reworking of the way AJAX is handled. But it solves problems
    in the interim and provides a significantly better experience.

    Thanks to Andy Chong for pushing forward with the initial attempts
    which lead to this patch.

    Fixes bug 943518.

    Change-Id: Ia65d926d3d406b07301e23b4c87de60c66ddec75

Changed in horizon:
status: In Progress → Fix Committed
Devin Carlen (devcamcar) on 2012-03-22
Changed in horizon:
milestone: none → essex-rc2
Devin Carlen (devcamcar) on 2012-03-22
tags: removed: essex-rc-potential
Thierry Carrez (ttx) on 2012-04-03
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in horizon:
milestone: essex-rc2 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers