Problema ao submeter um simples form

2 respostas
R

Pessoal…

eh uma coisa meio simples, mas nao funciona de jeito nenhum aki…

sempre q tento submeter meu form, vem um erro de JS dizendo q submit nao eh uma funcao…

meu codigo:

function <portletAPI:encodeNamespace value="doValidateSubmit"/>(actionURL)
{
    if (!document.<portletAPI:encodeNamespace value="pagedetail" />.pageTitle.disabled && document.<portletAPI:encodeNamespace value="pagedetail"/>.pageTitle.value == "")
	{
        alert('<portletAPI:text bundle="nls.properties" key="properties.alert.title.empty"/>');
        document.<portletAPI:encodeNamespace value="pagedetail"/>.pageTitle.focus();
    }
    else {
        document.<portletAPI:encodeNamespace value="pagedetail"/>.action = actionURL;
        document.<portletAPI:encodeNamespace value="pagedetail"/>.submit();
        return false;
    }
}

<form name='<portletAPI:encodeNamespace value="pagedetail"/>' method="GET" onsubmit='return false;'>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
	<tr>
	<td valign="top" align="center" height="400" bgcolor="white">
	<table border ="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
	<tr>
		<td>&nbsp;&nbsp;</td>
		<td valign="top" >
<table border="0" cellpadding="2" cellspacing="0">
	<tr>
		<td colspan="2"><h1><portletAPI:text bundle="nls.properties" key="page.new"/></h1></td>
	</tr>
	<tr>
		<td colspan="2">
			<p class="sub-head"><portletAPI:text bundle="nls.properties" key="page.new.info" /></p>
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><h2 class="green-dark"><portletAPI:text bundle="nls.properties" key="page.add"/></h2></td></tr>
	<tr>
		<td><label for="pageTitleId"><portletAPI:text bundle="nls.properties" key="page.name"/></label></td>
		<td><input type="text" class="portlet-form-input-field" size="40" name="pageTitle" value="<%= contentnode.title %>" id="pageTitleId" maxlength="250" /><portletAPI:text bundle="nls.properties" key="page.name.info" />
		</td>
	</tr>
</table>

<p class="float-right">
	<span class="button-blue"><input type="button" name="submit" value="Submit" onClick='<portletAPI:encodeNamespace value="doValidateSubmit"/>("<portletAPI:createURI><portletAPI:URIAction name='><%=CustomizerConfig.PROPERTIES_OK%>'/></portletAPI:createURI>"); return false;'/></span>
      	<a href="<portletAPI:createURI><portletAPI:URIAction name='<%=CustomizerConfig.PROPERTIES_CANCEL%>'/></portletAPI:createURI>"  >
	<span class="button-blue"><input type="button" name="cancel" value="Cancel"/></span></a>
</p>
		</td>
	</tr>
	</table>
	</form>
	</td>
	</tr>
</table>

alguma sugestao??

valew

2 Respostas

_fs

Cara, isso aqui:

document.<portletAPI:encodeNamespace value="pagedetail"/>

Não me parece uma sintaxe JavaScript válida. Tenta abrir a página no FireFox para receber uma mensagem de erro mais coerente.

De qualquer maneira, busque trabalhar com IDs, que é o padrão.

document.getElementById( 'meuForm' ).submit();
R

entao Lipe…

o lance da tag eh q temos q usar ela pq to trabalhando com Portal…e essa tag serve p/ identificar qual form estamos falando…
ela funciona direitinho, como deveria…

valew

Criado 11 de julho de 2005
Ultima resposta 11 de jul. de 2005
Respostas 2
Participantes 2