Escaping Quotes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Escaping Quotes

Justin Will
What is the correct way to deal with quotes in an input field?

If my field contains this.
[Table]Field:="If my life were a song the title would be \"The Comeback
Kid.\""

This breaks
<input name="somefield" value="<%=[Table]Field%>">

Is this the Correct Form?<input name="somefield" value="<%=html
encode([Table]Field)%>">

Thanks
Justin Will


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Escaping Quotes

Aparajita Fishman
> Is this the Correct Form?<input name="somefield" value="<%=html
> encode([Table]Field)%>”>

Use ‘url encode’, not ‘html encode’.

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Escaping Quotes

Justin Will
In reply to this post by Justin Will
So learning the URL Encode is the proper mechanism is there a shortcut like to make this easier for use in buckets of fields on a form?  I assume no but it would be really cool!

<%=+[Table]Field%>

Thanks
Justin Will

----------------------------------------
From: "Aparajita Fishman" <[hidden email]>
Sent: Thursday, April 30, 2015 10:26 AM
To: [hidden email], "Active4D Developer Discussion List" <[hidden email]>
Subject: Re: [Active4d-dev] Escaping Quotes

> Is this the Correct Form?<input name="somefield" value="<%=html
> encode([Table]Field)%>">

Use 'url encode', not 'html encode'.

Regards,

  Aparajita


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Escaping Quotes

Aparajita Fishman
> is there a shortcut like to make this easier for use in buckets of fields on a form?

Yes, create a library method that writes the whole field.

method "writeInput"($name; $value; $class = ""; $extra = "")

    writeln('<input name="$name" value="`url encode($value)`" class="$class" $extra>')

end method

writeInput("foo"; [table]field)
writeInput("foo"; [table]field; "form"; "onblur=\"doSomething();\"")

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Escaping Quotes

Justin Will
In reply to this post by Justin Will
Brilliant..Thanks!

Thanks
Justin Will

----------------------------------------
From: "Aparajita Fishman" <[hidden email]>
Sent: Thursday, April 30, 2015 3:35 PM
To: [hidden email], "Active4D Developer Discussion List"
<[hidden email]>
Subject: Re: [Active4d-dev] Escaping Quotes

> is there a shortcut like to make this easier for use in buckets of fields
on a form?

Yes, create a library method that writes the whole field.

method "writeInput"($name; $value; $class = ""; $extra = "")

    writeln('<input name="$name" value="`url encode($value)`"
class="$class" $extra>')

end method

writeInput("foo"; [table]field)
writeInput("foo"; [table]field; "form"; "onblur=\"doSomething();\"")

Regards,

  Aparajita


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/