Problem field alignment on a form

I am having problems with forms, in short I see two issues:

  1. Field titles (labels):
    Some titles/fields print on one line while others “wrap” around an are displayed in more than one line, I need to control them so they print in one line.

  2. Columns:
    Have a form with a block defined to print 2 fields per line.
    The first field is displaying way over to the left of the form while the second one is displaying way over to the right of the form, this leaves a “huge” amount of blank spaces between the two fields. Can someone tell me how to control how the form display the fields? I would like to control where and how fields are displayed.

Thanks.

Re: Problem field alignment on a form

  1. This occurs when the form width is less then needed. When you have a table with a little width, the HTML itself(the browser) breaks the line when find an empty space.
    Edit your table width in Form -> Settings -> Table Width and force a width that dont break your html and change Form -> Settings -> Table Width Unit to Pixel.

Or simple edit your field DISPLAY SETTINGS -> Css of the Title -> Width. Its not the nice why, because your html is breaking due to the table width.

  1. I dont uderstand right … can you put a print to explain more?

Re: Problem field alignment on a form

Thank you Diego.
Somehow the form corrected itself so I can not send you a display, not sure what I changed.

I did have one other problem you might want to try out but is not an alignment problem is an update problem:

I have a form with 2 “required fields” (e.g.: field-1, field-2).
On the form, I defined the two fields as “Select” type and have the lookup as “Automatic” where I display a list of codes and descriptions to choose from.

My business rule says:
“Only” when the field-1 = ‘04’ the user must enter field-2 which is a required field.

On my “onValidate” event I added code to “turn-off” required field for field-2 when field-1 is NOT = ‘04’.

Results(problem):
The form does not take any updates for field-1 or field-2 unless I set field-1 = ‘04’.

This has taken me days an finally today I when to my “onValidate” event and commented that code out and now the form works and is now taking the updates, I can set field-1 to any value from the list and the update takes place, I am not sure why do you ??? Here is the code I commented out:

onValidate event:

if ({field-1 !== ‘04’}) {
sc_field_required({field-2}, ‘off’);
}

Re: Problem field alignment on a form

the syntax is incorrect

see your code: if ({field-1 !== ‘04’}) {
now see the difference: if ({field-1} != ‘04’) {

The field must be between “{}” not the entire condition.
Other thing is … to check the value you must enter “==” or “!=” … with “!==” your are testing the type of the variable.

To do what you want, just do this:

in the form menu -> Form Settings -> Required turn on only the first field.
Now on the onValidation enter your code:

//if the first field is 4 and the second one is empty, show an error. Else, continue
//if first field is int, the value will be 4 instead of 04
if({first_field} == 4 && empty({second_field}))
{
sc_error_message(“Please, fill the second field!”);
}

Re: Problem field alignment on a form

Gracias Diego I will try this out.