0

I'm making Spring Web Flow app with validation and opportunity to load a photo, but unfortunately when i click submit button on my form nothing is happening. flow.xml file:

  <?xml version="1.0" encoding="UTF-8"?>
  <flow xmlns="http://www.springframework.org/schema/webflow"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">


<var name="user" class="entity.User"/>

<view-state id="registratingForm" view="/WEB-INF/pages/registration.jsp" model="user">
    <transition on="submit" to="validate"/>
</view-state>


<action-state id="validate">
    <evaluate expression="userServiceImpl.valid(requestParameters.photo,messageContext)" />
    <transition on="valid" to="saveUser" />
    <transition on="invalid" to="end-point" />
</action-state>
<action-state id="saveUser">
    <evaluate expression="userServiceImpl.add(user)" result="user" />
    <evaluate expression="userServiceImpl.validateImg(requestParameters.photo,user)"  result="user"/>
    <transition to="end-point" />
</action-state>
<end-state id="end-point" view="/index.jsp"/>
</flow>

My form :

       <form:form modelAttribute="user" enctype="multipart/form-data">
    <table>
        <tr>
            <td><form:label path="login">Логін:</form:label></td>
            <td><form:input path="login"/> <form:errors path="login" cssClass="isa_error"/></td>
        </tr>
        <tr>
            <td><form:label path="password">Пароль:</form:label></td>
            <td><form:password path="password"></form:password><form:errors path="password" cssClass="isa_error" /> </td>
        </tr>
        <tr>
            <td><form:label path="email">Пошта(електронна):</form:label></td>
            <td><form:input path="email"/> <form:errors path="email" cssClass="isa_error"/></td>

        </tr>
        <tr>
          <td><form:label path="about">Опис</form:label></td>
            <td><textarea name="about" cols="40" rows="10">Введіть опис сюди!</textarea></td>
        </tr>
        <tr>
            <td>Аватар:</td>
            <td><input name="photo" type="file" ></td>

        </tr>
        <tr>
            <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
            <td><input  type="submit" value="Додати" name="_eventId_submit" onclick="this.disabled=true;this.value='Виконується!';this.form.submit();"></td>
        </tr>
      <tr>
          <td><form:errors cssClass="isa_error" delimiter=""/> </td>

      </tr>
    </table>
<p>
    <a href="/index.jsp" class="button">На головну!</a>

</p>

I dont know what went wrong, couse i had similar flow form to this and it has been working properly, i wanted to debug but i dont know how to do it.

1 Answer 1

0

Already fixed ! The problem was in this code :

onclick="this.disabled=true;this.value='Виконується!';this.form.submit();"

I've been making submit without value, that's why my flow didn't move

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.