Ir para conteúdo
Fórum Script Brasil
  • 0

Por Favor Me Ajudem!


Guest - Cezar -

Pergunta

Guest - Cezar -

Ola pessoal!

Tenho um script de classificados com os campos nome, email, preço etc... e tambem tem o campo do anuncio "a area de texto" que e onde esta o problema.

O caso e que do jeito que esta o usuario não tem limite de caracteres e ele pode inserir um jornal inteiro.

Gostaria que "alguém" por favor me ajudasse a resolver isso.

Eu precisaria colocar um limite de por ex: maximo 150 caracteres, assim todos os anuncios ficariam padrão.

Alias, este script mesmo sendo simples, funciona bem.

abaixo esta o arq que tem o codigo:

<!-- #include file="QCLib.asp" -->

<%

'*******************************************************************************

'* QuickClassifieds Copyright 2003 XCENT - www.xcent.com *

'* QuickClassifieds is a trademark of XCENT *

'* This notice may not be removed from this source code file *

'*******************************************************************************

sName = RequestValue("name")

sEmail = RequestValue("email")

sAddress = RequestValue("address")

sCity = RequestValue("city")

sState = RequestValue("state")

sZip = RequestValue("zip")

sCountry = RequestValue("country")

sTitle = RequestValue("title")

sContent = RequestValue("adcontent")

sLink = RequestValue("link")

sImage = RequestValue("imageurl")

fPrice = fVal(RequestValue("price"))

lCatID = fVal(RequestValue("catID"))

sCmd = RequestValue("CMD")

Set objErr = CreateObject("Scripting.Dictionary")

'set the formatting for the form to enter ads

sLabelCellOpen = "<tr><td width=""33%"" bgcolor=""" & gsPageBGColor & """>" & gsLabelOpen

sLabelCellClose = gsLabelClose & "</td>"

sInfoCellOpen = "<td width=""67%"" bgcolor=""" & gsPageBGColor & """>" & gsPlainTextOpen

sInfoCellClose = gsPlainTextClose & "</td></tr>"

DoPageHeader

OpenDBConn

TableHead GLS_PlaceAd

Select Case sCmd

Case "POST"

If CheckForm Then

PostAd

Else

ShowForm

End If

Case Else

ShowForm

End Select

TableFoot lCatID

CloseDBConn

DoPageFooter

set objErr = Nothing

Sub PostAd

vNow = Now

Set rsAd = Server.CreateObject("ADODB.RecordSet")

rsAd.Open "tblQCAds", gobjConnect, 1, 3, &H0002 'adOpenKeyset, adLockOptimistic, adCmdTable

rsAd.AddNew

rsAd("cadTopicID") = lCatID

rsAd("cadName") = sName

rsAd("cadEmail") = sEmail

rsAd("cadAddress") = sAddress

rsAd("cadCity") = sCity

rsAd("cadState") = sState

rsAd("cadZip") = sZip

rsAd("cadCountry") = sCountry

rsAd("cadTitle") = sTitle

rsAd("cadLink") = sLink

rsAd("cadDatePosted") = vNow

rsAd("cadImage") = sImage

rsAd("cadPrice") = fPrice

rsAd("cadContent") = sContent

rsAd.Update

lNewAdID = FVal(rsAd("cadID"))

rsAd.Close

set rsAd = Nothing

Response.Write gsPlainTextOpen & GLS_AdPostSuccess & "<BR>"

Response.Write "<A HREF=""QCViewDetail.asp?id=" & lNewAdID & """>" & GLS_AdPostView & "</A>" & gsPlainTextClose & "<BR>"

End Sub

Sub ShowForm

Response.Write "<CENTER>" & gsPlainTextOpen & GLS_ItemsMarked & gsPlainTextOpen & "</CENTER>"

Response.Write "<FORM METHOD = ""POST"" ACTION=""QCNewAdForm.asp"">"

Response.Write "<INPUT TYPE=""HIDDEN"" NAME=""cmd"" VALUE=""POST"">"

Response.Write "<TABLE border=""0"" cellspacing=""0"" width=""100%"" align=""CENTER"">"

Response.Write "<tr><td colspan=""2"" bgcolor=""" & gsPageBGColor & """>" & gsSubHeadOpen & GLS_YourInfo & gsSubHeadClose & "</td></tr>"

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("NAME"), True, objErr.Item("NAME"),GLS_YourName ) & gsReqSymbol & sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""name"" size=""27"" value=""" & sName & """ maxlength=""65"">" & sInfoCellClose

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("EMAIL"), True, objErr.Item("EMAIL"),GLS_EmailAddress )

ShowRequired(gbReqEmail)

Response.Write sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""email"" size=""27"" value=""" & sEmail & """ maxlength=""80"">" & sInfoCellClose

If gbShowStreet Then

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("STREET"), True, objErr.Item("STREET"),GLS_StreetAddress )

ShowRequired(gbReqStreet)

Response.Write sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""address"" size=""27"" value=""" & sAddress & """ maxlength=""65"">" & sInfoCellClose

End If

If gbShowCity Then

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("CITY"), True, objErr.Item("CITY"),GLS_City )

ShowRequired(gbReqCity)

Response.Write sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""city"" size=""27"" value=""" & sCity & """ maxlength=""50"">" & sInfoCellClose

End If

If gbShowState Then

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("STATE"), True, objErr.Item("STATE"),GLS_State )

ShowRequired(gbReqState)

Response.Write sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""state"" size=""3"" value=""" & sState & """ maxlength=""20"">" & sInfoCellClose

End If

If gbShowZipCode Then

Response.Write sLabelCellOpen & GLS_ZipCode & sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""zip"" size=""11"" value=""" & sZip & """>" & sInfoCellClose

End If

If gbShowCountry Then

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("COUNTRY"), True, objErr.Item("COUNTRY"),GLS_Country )

ShowRequired(gbReqCountry)

Response.Write sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""country"" size=""27"" value=""" & sCountry & """ maxlength=""50"">" & sInfoCellClose

End If

Response.Write "<tr><td colspan=""2"" bgcolor=""" & gsPageBGColor & """><P>&nbsp</P></td></tr>"

Response.Write "<tr><td colspan=""2"" bgcolor=""" & gsTableColor & """>" & gsSubHeadOpen & GLS_AdInformation & gsSubHeadClose & "</td></tr>"

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("CATEGORY"), True, objErr.Item("CATEGORY"),GLS_AddItemCat ) & gsReqSymbol & sLabelCellClose

Response.Write sInfoCellOpen

Response.Write "<SELECT NAME=""catID"">"

GetCategories

Response.Write "</SELECT>"

Response.Write sInfoCellClose

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("TITLE"), True, objErr.Item("TITLE"),GLS_AdTitle ) & gsReqSymbol & sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""title"" size=""27"" value=""" & sTitle & """ maxlength=""50"">" & sInfoCellClose

If gbShowPrice Then

Response.Write sLabelCellOpen & OutMatch(objErr.Exists("PRICE"), True, objErr.Item("PRICE"),GLS_AdPrice )

ShowRequired(gbReqPrice)

Response.Write sLabelCellClose

Response.Write sInfoCellOpen & gsMoneySymbol & "<input type=""text"" name=""price"" size=""10"" value=""" & OutMatch(fPrice,0, "", fPrice) & """>" & sInfoCellClose

End If

DEVE ESTAR POR AQUI

Response.Write "<tr><td width=""180"" bgcolor=""" & gsPageBGColor & """ valign=""top"">" & gsLabelOpen & OutMatch(objErr.Exists("CONTENT"), True, objErr.Item("CONTENT"),GLS_AdContent ) & gsReqSymbol & sLabelCellClose

Response.Write sInfoCellOpen & "<textarea rows=""9"" name=""adcontent"" cols=""39"">" & sContent & "</textarea>" & sInfoCellClose

Response.Write "<tr><td colspan=""2"" align=""CENTER""><FONT face=""" & gsFont & """ color=""#FF0000"" size=""2""><B>" & GLS_IncludeHTTP & "</B></FONT></td></tr>"

Response.Write sLabelCellOpen & GLS_AdLink & GLS_Optional & sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""link"" size=""27"" value=""" & sLink & """ maxlength=""100"">" & sInfoCellClose

Response.Write sLabelCellOpen & GLS_ImageURL & GLS_Optional & sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""text"" name=""imageurl"" size=""27"" value=""" & sImage & """ maxlength=""255"">" & sInfoCellClose

Response.Write sLabelCellOpen & "&nbsp;" & sLabelCellClose

Response.Write sInfoCellOpen & "<input type=""submit"" value=""" & GLS_Submit & """ name=""B1"">"

Response.Write "&nbsp;<input type=""reset"" value=""" & GLS_Reset & """ name=""B2"">" & sInfoCellClose

Response.Write "</table></FORM>"

End Sub

sub ShowRequired (bParam)

If bParam then

Response.write gsReqSymbol

End if

end sub

Sub GetCategories

sSQL = ""

sSQL = sSQL & "SELECT catID, catName FROM tblQCCategories ORDER BY catName"

Set rsCats = GobjConnect.Execute(sSQL)

If rsCats.EOF Then

Response.Write "<OPTION VALUE=""0"">" & GLS_NoCategory & "</OPTION>"

Else

Do While NOT rsCats.EOF

Response.Write "<OPTION VALUE=""" & rsCats("catID") & """"

If lCatID=FVal(rsCats("catID")) Then Response.Write " SELECTED "

Response.Write ">" & rsCats("catName") & "</OPTION>"

rsCats.MoveNext

Loop

End If

rsCats.Close

Set rsCats = Nothing

End Sub

Function CheckForm

objErr.RemoveAll

If Len(Trim(sName)) = 0 Then

objErr.Add "NAME", gsErrorTextOpen & GLS_InvalNameFld & gsErrorTextClose

End If

If Len(Trim(sEmail)) = 0 and gbReqEmail Then

objErr.Add "EMAIL", gsErrorTextOpen & GLS_InvalEMailFld & gsErrorTextClose

End If

If Len(Trim(sStreet)) = 0 and gbReqStreet and gbShowStreet Then

objErr.Add "STREET", gsErrorTextOpen & GLS_InvalStreetFld & gsErrorTextClose

End If

If Len(Trim(sCity)) = 0 and gbReqCity and gbShowCity Then

objErr.Add "CITY", gsErrorTextOpen & GLS_InvalCityFld & gsErrorTextClose

End If

If Len(Trim(sState)) = 0 and gbReqState AND gbShowState Then

objErr.Add "STATE", gsErrorTextOpen & GLS_InvalStateFld & gsErrorTextClose

End If

If Len(Trim(sCountry)) = 0 and gbReqCountry AND gbShowCountry Then

objErr.Add "COUNTRY", gsErrorTextOpen & GLS_InValCountryFld & gsErrorTextClose

End If

If Len(Trim(sTitle)) = 0 Then

objErr.Add "TITLE", gsErrorTextOpen & GLS_InValTitleFld & gsErrorTextClose

End If

If fPrice = 0 and gbReqPrice AND gbShowPrice then

objErr.Add "PRICE", gsErrorTextOpen & GLS_InValPriceFld & gsErrorTextClose

End if

If Len(Trim(sContent)) = 0 Then

objErr.Add "CONTENT", gsErrorTextOpen & GLS_InValContentFld & gsErrorTextClose

End If

If lCatID = 0 Then

objErr.Add "CATEGORY", gsErrorTextOpen & GLS_InvalCategory & gsErrorTextClose

End If

If objErr.Count > 0 Then

CheckForm = False

Else

CheckForm = True

End If

End Function

%>

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0
Guest Ola amigo

Mas como eu insiro isso naquele codigo em asp?

não tem como eu colocar so um comando a mais tipo "maxlength" ou maxlimit na linha. não precisa contar os caracteres, somente LIMITAR o usuario a escrever no max tantos caracteres.

Obrigado desde já.

Cezar

Link para o comentário
Compartilhar em outros sites

  • 0
Guest Ola amigo

Mas como eu insiro isso naquele codigo em asp?

não tem como eu colocar so um comando a mais tipo "maxlength" ou maxlimit na linha. não precisa contar os caracteres, somente LIMITAR o usuario a escrever no max tantos caracteres.

Obrigado desde já.

Cezar

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,7k
×
×
  • Criar Novo...