Validation Message (!) does not show up in ajax mode for a String Field in 
"textarea" styling mode
--------------------------------------------------------------------------------------------------

                 Key: COCOON-1930
                 URL: http://issues.apache.org/jira/browse/COCOON-1930
             Project: Cocoon
          Issue Type: Bug
          Components: Blocks: Forms
    Affects Versions: 2.1.9
            Reporter: Gabriel Gruber


If you make a String field of a cforms Form required and render the field using 
the type "textarea". The validation message in case of an empty fieldcontent 
does not appear correctly in AJAX mode.

What happens is that the html snippet to be updated is inserted within the 
textarea:

<a id="forms-validation-message-page1.email" class="forms-validation-message" 
href="#" onclick="alert('Dieses Feld muss aufgefüllt werden.'); return false;"> 
! </a><span class="forms-field-required"> * </span><div 
style="visibility:hidden; position:absolute;" id="page1.email:help" 
class="forms-help"><span style="float:right"><a 
onClick="document.getElementById('page1.email:help').style.visibility = 
'hidden';return false;" href="#"><img width="6" height="6" 
src="/_cocoon/resources/forms/img/close.gif" alt="close" 
align="top"/></a></span>
            An email address must be in <i 
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";>[EMAIL PROTECTED]</i> 
format.
            <br xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"/>
            And if you do not know what <b 
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";>email</b> address is, 
then well, chances are
            that you do not have it. However, if you have access to the 
Internet,
            you can easily get yourself one!
            <br xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"/>
            Choose one of the following options:
            <ul xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";>
                        <li><a href="http://mail.yahoo.com/";>Yahoo! 
Mail</a></li>
                        <li><a href="http://www.hotmail.com/";>Hotmail</a></li>
                </ul>
                <small 
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";>Anyway, the point of all 
this was to show a popup help with mixed html content.</small>
        </div><a 
onclick="forms_createPopupWindow('page1.email:help').showPopup('page1.email:help:a');return
 false;" href="#" id="page1.email:help:a"><img alt="helppopup" 
src="/_cocoon/resources/forms/img/help.gif"/></a></span>


*** HOWTO reproduce the problem:

- Patch the multipage wizard (ajax) within the cforms samples 
(http://localhost:8888/samples/blocks/forms/do-multipage.flow)
- style the email field in the file multipage_template.xml as textarea:
line 42:
                <ft:widget id="email">
                                        <fi:styling type="textarea" cols="20" 
rows="5"/>
                                </ft:widget>

- remove the email validation inside the field definition in file 
multipage_model.xml

        <fd:field id="email" required="true">
          <fd:datatype base="string"/>
          <!-- new-style validation, outside of the datatype -->
          <!--fd:validation>
            <fd:email/>
          </fd:validation-->
          <fd:label>Enter an <b>email</b> address:</fd:label>
          <fd:help>
            An email address must be in <i>[EMAIL PROTECTED]</i> format.
            <br/>
            And if you do not know what <b>email</b> address is, then well, 
chances are
            that you do not have it. However, if you have access to the 
Internet,
            you can easily get yourself one!
            <br/>
            Choose one of the following options:
            <ul>
              <li><a href='http://mail.yahoo.com/'>Yahoo! Mail</a></li>
              <li><a href='http://www.hotmail.com/'>Hotmail</a></li>
            </ul>
            <small>Anyway, the point of all this was to show a popup help with 
mixed html content.</small>
          </fd:help>
        </fd:field>

Now open the sample form again and try to click instantly the next button and 
you will notice the above described bug!

Seems to be a problem of the javascript inserting the new HTML code at the 
wrong position....

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to