Forums

Can't save/edit form (yes I checked the FAQ)

megana 28 Jan, 2015
Hi there,

I added a Custom Code block to the On Load event of my form and was happily editing/saving/testing when suddenly the form stopped saving. Now whenever I save, I get this error:

Save Failed
A form title is required and should NOT have any spaces or special characters.

And the title says "New Form....." and the form name, designer box, and events boxes are all empty. As if I was starting a brand new form rather than editing an existing one.

I tried editing my form again and just saving it without making any changes, but the same thing happened. I tried deleting the Custom Code block but it still won't save. I looked in the database to see if I could manually remove the Custom Code block, but I can't make sense of what I'm seeing.

Is there a way to salvage my form or should I just start over with it?
BNDragon 29 Jan, 2015
Hi megana,

The error is very specific, it talks about the form title, what is weird because you have it in other times.

And you can't save without the custom code (That give me already problems and I need to import a file with the code), so I only see one last shoot, try make a backup and restore it and see if it work.

BN
megana 29 Jan, 2015
Hi BN,

I just tried a backup and restore, but unfortunately it didn't help. ๐Ÿ˜Ÿ
GreyHead 29 Jan, 2015
Hi megana,

Please see this FAQ I think that may show the problem.

Bob
megana 29 Jan, 2015
Hi GreyHead,

Yes that's the FAQ I looked at. I'm not sure which part might apply in this case? I tried the error reporting, but it still only shows the same error when I try to save. It's a very small form, so I don't think it's the number of inputs causing the problem.
megana 30 Jan, 2015
So I tried rebuilding my form. Instead of a Custom Code action, I tried to use a DB Read action with an external database. I don't think the DB Read will work for me because for fields I need it to get "DISTINCT city". After saving and viewing my form, I did indeed get the error "Unknown column 'Data.DISTINCT city' in 'field list'..."

I went back to edit it, however now I'm getting the previous error when I try to save my form again. AUGH! This is really starting to get annoying!
BNDragon 30 Jan, 2015
Hi megana,

Just guessing but it could be a some corrupt file. What I can suggest is to reinstall your CF.

Do a backup of all your forms, uninstall CF and the install it again, then just restore your forms.

BN
megana 30 Jan, 2015
Hi BN,

Ok I'll try that. Can I select all my forms at once and click backup, or do I need to do them one by one?
BNDragon 30 Jan, 2015
Hi megana,

Good question, the only time I backup-ed only needed one form, so you'll need to try it to know your answer๐Ÿ˜‰

Try do the backup of all forms and restore then (without reinstall).
Then I appreciate a feedback to know if it works๐Ÿ™‚

BN
megana 30 Jan, 2015
Hi BN,

Yes it seems they all can be backed up together!

Unfortunately, the reinstall didn't fix anything.๐Ÿ˜Ÿ
BNDragon 30 Jan, 2015
1 Likes
Hi megana,

Unfortunately I can't remember anything more to do :/

Sorry, You need to wait for Bob or Max :/

BN
megana 30 Jan, 2015
Hi BN,

I appreciate you trying!
megana 02 Feb, 2015
I've narrowed down the source of the problem.

First I figured out a workaround to get the form to save again. If I go to the Code tab and change the form type to Custom Code, then delete everything in the Form Code box, now I can save my form. Then I change it back to Wizard Designer, and I can still save.

But the NEXT time I try to save, I get the error message again. So I have to keep repeating these steps after each edit.

So by changing one thing each time, I was able to figure out that the save error starts when I change my form dropdown to use dynamic data. Whether I was using Custom Code or a DB Read action to connect to the external database didn't matter, but as soon as I said Dynamic Data -> Enabled = Yes on the dropdown element, suddenly I could no longer save.

I thought perhaps the save error was because I didn't have the dynamic data pulling in properly yet, but even now that I have it working, I still have the same problem saving.
megana 24 Jun, 2015
I finally narrowed this down a bit.

Putting this in a Custom Code box results in the Save Failed/blank edit form error:
<?php if($l['reduction']=='1') { echo 'selected'; } ?>


This saves fine:
<?php if($l['reduction']=='1') { echo '1'; } ?>


So...it seems to have a problem with the word 'selected'?
GreyHead 25 Jun, 2015
Hi Megana,

I can imagine that might cause a problem. What else do you have in that Custom Code box and what is it intended to do?

Bob
megana 25 Jun, 2015
Trying to build a dropdown and specify which option should be selected. There were various reasons why I had to build it with custom code instead of just dragging a Dropdown field onto the form.
GreyHead 25 Jun, 2015
Hi megana,

I've done this with PHP like this in a Custom Code element
<?php
. . .
$options_array = array();
foreach ( $some_array as $l ) {
  $selected = '';
  if ( $l['reduction'] == '1' ) {
   $selected = " selected='selected' ";
  }
  $options_array[] = "<option value='{$l['reduction']}' {$selected} >{$l['text']}</option>";
}
$options = implode("\n", $options_array);
echo "<select . . . >{$options}</select>";
?>

Bob
megana 25 Jun, 2015
Yes that's almost exactly what I'm using! The only difference is I was outputting the options immediately instead of collecting them and outputting them at the end. I'll have to try it your way and see if that fixes it...
This topic is locked and no more replies can be posted.