hallo zusammen,

Ich habe einen Problem ,und zwar der javascriptcode wird nicht ganz vom facelets erkannt,und zwar wenn ich in der funtion checkInput() den if-zweig wegmache ,und nur window.alert("Bitte ...); lasse dann wirds ausgeführt sonst nicht.
woran kann es liegen dass manche befehle nicht gehen?
- var element = document.getElementById wird auch nicht erkannt

danke voraus





Code java:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<ui:component xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:c="http://java.sun.com/jstl/core">
    <ui:define name="faceletHeader">
        <link rel="stylesheet" type="text/css" href="css/mycss.css" />
        <script type="text/javascript">
        function checkInput(){
            var element = document.getElementById("userid");
            if (element.value == "") { 
                  window.alert("Bitte geben Sie Ihren benutzernamen an.");
                  element.className ='fehler';
                  element.focus();
                  return false;
                }
            }
        
        </script>
    </ui:define>
    <ui:define name="faceletContent">
            <h:form>
            <center>
                <h:panelGrid  width="272px"  columns="1" border="0">
                <rich:panel  id="login"  headerClass="head" styleClass="loginPanel">             
                    <f:facet name="header">
                           <h:outputText value="LOGIN " style="padding-left:14px;" ></h:outputText>
                    </f:facet>              
                        <h:panelGrid columns="1"  rowClasses="myrows3">
                            <h:outputText value="Benutzername" styleClass="ueberschrift-klein"/> 
                            <h:inputText id="userid" value="#{userid}" styleClass="input4"/>
                            <h:outputText value="Passwort" styleClass="ueberschrift-klein"/> 
                            <h:inputSecret id="password" value="#{password}" styleClass="input4"/>      
                            <h:commandLink styleClass="button"  action="#{backingBeanName[actionName]}"  onclick="return checkInput();"  value="login" />
                                                    
                            
                        </h:panelGrid>  
                </rich:panel>
                </h:panelGrid>
             </center>
             </h:form>
    </ui:define>
</ui:component>