This works in ceylon:
<form action="contacts" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" />
<label for="address">Address:</label>
<textarea rows="5" cols="40" id="address" name="address" ></textarea>
<label for="phone">Phone:</label>
<input type="text" id="phone" name="phone" />
<label for="email">Email:</label>
<input type="text" id="email" name="email" />
<input type="submit" name="sumbit"/>
</form>
I can do request.parameters("name") and everything works as expected...
This does not work in ceylon (But does in other languages):
<form>
<label for="frmName">Name:</label>
<input type="text" id="frmName" name="frmName" />
<label for="frmAddress">Address:</label>
<textarea rows="5" cols="40" id="frmAddress" name="frmAddress" ></textarea>
<label for="frmPhone">Phone:</label>
<input type="text" id="frmPhone" name="frmPhone" />
<label for="frmEmail">Email:</label>
<input type="text" id="frmEmail" name="frmEmail" />
<button onclick="saveContact(); return false;" >Save</button>
</form>
with associated jquery:
var saveContact = function(){
clearNotices();
var strId = $("#frmContacts").find(":selected").val();
var strName = $("#frmName").val();
if((strName == "")||(strName.search(/\S/) == -1)){
notice("A name is required to save a new contact.");
return;
}
var strAddress = $("#frmAddress").val();
var strPhone = $("#frmPhone").val();
var strEmail = $("#frmEmail").val();
if(strId == "-1"){//new
var url = "/contacts/";
$.post(url,
{ 'utf8':"✓", 'authenticity_token': "lJxO7oZQ460Rw3+4bk/aO9kpKhdO3+bUFmt+cByPsC8=",
'contact[name]': strName, 'contact[address]': strAddress,
'contact[phone]': strPhone, 'contact[email]': strEmail },
function(data){
retrieveContactList();
});
}else{//update
var url = "/contacts/"+strId;
$.post(url,
{ 'utf8':"✓", '_method':'put', 'authenticity_token': "lJxO7oZQ460Rw3+4bk/aO9kpKhdO3+bUFmt+cByPsC8=",
'contact[name]': strName, 'contact[address]': strAddress,
'contact[phone]': strPhone, 'contact[email]': strEmail },
function(data){
retrieveContactList();
});
}
}
(replacing the request.parameters("bla") with the correct key values on the ceylon side of course)
it seems to not like the form encoding with xmlhttp request. When I debug into RequestImpl the formData is blank. Can anyone else confirm?
Thanks,
Andy